feat: Added support for merging targets in DNSEndpoint using a label
What does it do ?
This PR introduces a new strategy for merging targets in DNSEndpoint, activated by adding the label merge-strategy: merge-targets to the endpoint.
If this label is set, ExternalDNS will automatically merge targets across different owner-ids into a single resulting endpoint. No special configuration is needed—just add the label to the relevant endpoints.
Example:
If you have two DNSEndpoints (typically from different clusters or owners):
spec:
endpoints:
- dnsName: cloud.example.org
labels:
merge-strategy: merge-targets
recordTTL: 30
recordType: NS
targets:
- gslb-ns-eu-cloud.example.org
and
spec:
endpoints:
- dnsName: cloud.example.org
labels:
merge-strategy: merge-targets
recordTTL: 30
recordType: NS
targets:
- gslb-ns-us-cloud.example.org
ExternalDNS will merge the targets in DNS as follows:
- gslb-ns-eu-cloud.example.org
- gslb-ns-us-cloud.example.org
Note:
- It is up to the client/controller to ensure that their DNSEndpoints are kept up to date and synchronized properly.
- It doesnt handle deletes or updates
Motivation
Enable merging of DNS targets from multiple owners by adding a single label, making multi-cluster or multi-controller setups simpler and conflict-free.
More
- [x] Yes, this PR title follows Conventional Commits
- [x] Yes, I added unit tests
- [ ] Yes, I updated end user documentation accordingly
- please can you navigate me, where I can update doc?
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign mloiseleur for approval. For more information see the Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Welcome @kuritka!
It looks like this is your first PR to kubernetes-sigs/external-dns 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.
You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.
You can also check if kubernetes-sigs/external-dns has its own contribution guidelines.
You may want to refer to our testing guide if you run into trouble with your tests not passing.
If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!
Thank you, and welcome to Kubernetes. :smiley:
Hi @kuritka. Thanks for your PR.
I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
Hello @kuritka,
Thanks for this PR, this is quite a challenge for handling multi cluster. Without delete or update, it's maybe worth to consider other paths. We should probably take the time to discuss the design before starting the implementation.
First, this is quite unusual to implement features using labels. Would you please explain why you didn't just add a new field on the CRD ?
Second, wdyt about implementing a multiple ownership feature ? This would allow update and the complete deletion would happen when the last owner is deleting.
I'll put this on hold until there is a rework on the approach. /hold
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.
This bot triages PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the PR is closed
You can:
- Mark this PR as fresh with
/remove-lifecycle stale - Close this PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale