feat(dns): dns record requirer#506
Open
yanksyoon wants to merge 34 commits into
Open
Conversation
….yaml Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…lation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… dns-record relation - Add DNSRecordRequires import and initialize in HAProxyCharm.__init__ - Add _on_dns_record_relation_created and _on_dns_record_relation_joined event handlers - Implement _update_dns_records method that: * Publishes A records for managed hostnames * Uses VIP when HA relation is active * Falls back to ingress binding address otherwise - Call _update_dns_records from _reconcile to update DNS on config changes - Add dns_record_relation fixture for testing - Add context_with_dns_mock fixture with mocked services for unit tests - Add 4 test cases covering relation events and IP address selection logic Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ator Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove dns_record.dns_record from charm-libs (library is vendored, not published on Charmhub) — fixes 'Check libraries' CI failure - Apply ruff format to integration conftest.py (unnecessary parens) - Fix RUF005 violations in test_charm.py (use iterable unpacking) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the dns-record relation's network binding instead of the ingress relation binding. This ensures DNS records are assigned IPs in whatever subnet the dns-record interface is bound to.
…ord-requirer # Conflicts: # docs/changelog.md
Comment on lines
+566
to
+567
| # The try/except is needed for the relation_created/joined handlers which call | ||
| # _update_dns_records directly without going through _reconcile first. |
Collaborator
There was a problem hiding this comment.
Given that I think we are also updating the dns records towards the end of the reconcile loop, can't we also hook these 2 events to the reconcile loop? Since i think it's a bit strange to have this event-based logic in a holistic charm.
We're reloading the haproxy service so there should not be any impact on uptime if we run reconcile on all events
Thanhphan1147
approved these changes
Jun 2, 2026
Collaborator
Thanhphan1147
left a comment
There was a problem hiding this comment.
Approved with one last comment
Address review feedback: instead of dedicated handlers for dns-record relation_created/joined that call _update_dns_records directly, route these events through _on_config_changed -> _reconcile() like all other relation events in this holistic charm. Also migrates dns_record lib from charms.dns_record to charms.dns_integrator namespace (dns-record charm doesn't exist on Charmhub; dns-integrator does).
The dns_record library is published under the dns-integrator charm on Charmhub. Update charmcraft.yaml charm-libs so fetch-lib resolves correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Adds an optional
dns-recordrequirer integration that publishes DNS A records for HAProxy hostnames (derived from certificate requests), using the VIP when HA is active or the unit ingress address otherwise.Why we need it
Automates DNS record management for hostnames served by HAProxy, removing the need for manual DNS configuration.
Checklist
docs/changelog.mdwith user-relevant changesdocs/release-notes/artifacts. If no change artifact is necessary, I tagged the PR with the labelno-release-note.(e.g., in
.github/workflows/integration_tests.yaml, ensure themoduleslist is correct)terraform fmtpasses andtflintreports no errors