-
Notifications
You must be signed in to change notification settings - Fork 16
DNS Groups. #669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
DNS Groups. #669
Conversation
5f9673d to
29c24eb
Compare
...etup/dnsrecords/delegating/coredns/loadbalanced/dnsrecord-loadbalanced-coredns-cluster1.yaml
Outdated
Show resolved
Hide resolved
eaf200f to
6795ee1
Compare
| log | ||
|
|
||
| rewrite name regex kuadrant-active-groups\.(.*)k.example\.com kuadrant-active-groups-coredns.pb.hcpapps.net | ||
| forward kuadrant-active-groups-coredns.pb.hcpapps.net /etc/resolv.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will need to be updated to allow this custom host to be passed in at set up time, somehow, that's for another ticket: #670
098c135 to
e9364ce
Compare
Boomatang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a number of questions. I know it is still a draft and subject to change. For the reason I didn't look at any test changes.
b43bd9a to
9e54ed6
Compare
Boomatang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still haven't looked at the test. Seen a few very small things. But I started to question the use of group field on the remote reconciles.
I am going to start setting this up locally and play around with it.
| activeGroups := r.getActiveGroups(ctx, c, dnsRecord) | ||
|
|
||
| // only process unpublish when there are active groups and we are reconciling a record from an active group | ||
| if len(activeGroups) == 0 || !dnsRecord.IsActive() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this now can be simplified.
| if len(activeGroups) == 0 || !dnsRecord.IsActive() { | |
| if !dnsRecord.IsActive() { |
5caf25d to
a26babc
Compare
Signed-off-by: Phil Brookes <pbrookes@redhat.com> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
This PR introduces DNS Groups functionality to enable active-passive failover for DNS records across multiple clusters. Groups allow operators to control which cluster's DNS records are published based on a configurable "active groups" list, enabling scenarios like:
Changes
API Changes:
Core Implementation (internal/controller/dnsrecord_groups.go - new file):
Controller Changes (internal/controller/dnsrecord_controller.go):
Test Coverage:
How It Works
Each DNS operator instance is started with a group identifier:
--group=us-east
or
GROUP=us-east
Records managed by that operator inherit the group assignment in their status.
The active groups list is stored as a TXT record in DNS:
kuadrant-active-groups.example.com TXT "groups=us-east&&us-west;version=1"
Before publishing DNS records, each controller:
Queries the active groups TXT record
Compares its group against the active groups list
If inactive: Updates status condition and requeues (15s)
If active: Publishes its records AND cleans up records from inactive groups
Ungrouped Records
Records without a group assignment (group="") are always active and published alongside whichever groups are currently active. They will never process unpublishing of records.
Example Scenario:
Setup:
Active groups = ["us-east"]:
Published: 1.2.3.4, 9.9.9.9
Switch active groups to ["us-west"]:
Published: 5.6.7.8, 9.9.9.9
(Cluster B unpublishes stale 1.2.3.4)
Manual Verification Instructions
Prerequisites
Option 1: Verification with AWS Route53
Setup:
make local-setup with 2 clusters, and deploy true. Then edit the deployments to set the group runtime argument (e.g. us-east and us-west).
Create test DNSRecords:
In cluster-1
In cluster-2
Set initial active groups (us-east):
Using kuadrant-dns-cli, set the active group to us-east
Verify initial state:
Query DNS (should return 1.2.3.4)
dig test-groups.example.com +short
Check Route53 for published records
aws route53 list-resource-record-sets --hosted-zone-id
--query "ResourceRecordSets[?Name=='test-groups.example.com.']"
Use dns cli to update the TXT record in Route53 to us-west
Wait 15-30 seconds for reconciliation, then verify:
Query DNS (should now return 5.6.7.8)
dig test-groups.example.com +short
Verification Checklist
Related Issues: #620