Skip to content
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

fix: do not merge CNAME with multiple targets #4856

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

Conversation

dtuck9
Copy link

@dtuck9 dtuck9 commented Nov 7, 2024

Description

While using the Google Cloud DNS provider, we encountered the following error:

{"level":"error","msg":"googleapi: Error 400: Invalid value for 'entity.change.additions[<CNAME DNS Name>][CNAME].rrdata[1]': '<RRData[1].Value>', invalid","time":"2024-11-05T22:21:52Z"}`

Where <CNAME DNS Name> as the DNS Name and <RRData[1].Value> is the targeted hostname without a trailing .. After several hours of troubleshooting this failure, we discovered that it was actually a collision with a pre-existing DNS Name, and that the targets had been merged into the same Endpoint, where only rrdata[0] had the trailing . ensured by external-dns.

We attempted the following on our end to get around this unexpected behavior in order to trigger the expected 409 error:

  1. Ensure a trailing . in our hostname definitions -- this way the 2 rrdata values would at least pass the Cloud DNS API validation for the trailing ., and then fail with an error that makes more sense (CNAME not allowing more than one value in the rrdata). This however caused a reconciliation loop where external-dns kept deleting and re-adding the records in every batch.
  2. Set the external-dns.alpha.kubernetes.io/set-identifier annotation to prevent the merge in the first place, which would trigger the 409 for the CNAME DNS Name already existing. Unfortunately this also seemed to cause a reconciliation loop where external-dns kept deleting and re-adding the records in every batch.

I considered making a change in the Cloud DNS provider to avoid impacting other providers where perhaps this behavior is expected in order to allow different routing policies that are more tightly coupled with the DNS record. However, by the time the endpoint gets into the provider, the context of the duplicate record's resource label has already been lost due to the merge.

We are certainly open to suggestions on how to get around this behavior, or if you'd rather us file an issue and close this PR, that's fine, too.

No relevant user documentation was found.

Checklist

  • Unit tests updated
  • End user documentation updated

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 7, 2024
Copy link

linux-foundation-easycla bot commented Nov 7, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: dtuck9 / name: Diana (7e10c80)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Nov 7, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @dtuck9!

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
Copy link
Contributor

Hi @dtuck9. 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 the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 7, 2024
@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 raffo for approval. For more information see the Kubernetes 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 size/M Denotes a PR that changes 30-99 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 Nov 7, 2024
@dtuck9 dtuck9 marked this pull request as ready for review November 7, 2024 21:02
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 7, 2024
@mloiseleur
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 14, 2024
@mloiseleur
Copy link
Contributor

/retitle fix: do not merge CNAME with multiple targets

@k8s-ci-robot k8s-ci-robot changed the title Do not merge CNAME targets into one endpoint per RFC-1034 fix: do not merge CNAME with multiple targets Nov 14, 2024
@mloiseleur
Copy link
Contributor

/lgtm
/assign @Raffo

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 22, 2024
@mloiseleur mloiseleur removed their assignment Dec 22, 2024
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants