Skip to content

feat: Added support for merging targets in DNSEndpoint using a label #5619

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kuritka
Copy link

@kuritka kuritka commented Jul 7, 2025

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

  • Yes, this PR title follows Conventional Commits
  • Yes, I added unit tests
  • Yes, I updated end user documentation accordingly
    • please can you navigate me, where I can update doc?

Copy link

linux-foundation-easycla bot commented Jul 7, 2025

CLA Signed


The committers listed above are authorized under a signed CLA.

@k8s-ci-robot
Copy link
Contributor

[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.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the plan Issues or PRs related to external-dns plan label Jul 7, 2025
@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jul 7, 2025
@k8s-ci-robot
Copy link
Contributor

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. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 7, 2025
@k8s-ci-robot
Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jul 7, 2025
@mloiseleur
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. plan Issues or PRs related to external-dns plan size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants