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

Don't create endpoint if attempting to create one with invalid dns name #3017

Merged

Conversation

olemarkus
Copy link
Contributor

@olemarkus olemarkus commented Sep 10, 2022

Description

We should expect that 63 char labels works also with the txt registry. But as can be seen from #2839 and others, this is not the case after introducing the new format.

This PR doesn't fix the underlying problem in any way, but it maintains backwards compatibility by ignoring the new format if it results in endpoint with too long name. This way, e.g route53 batch changes will keep working with the consequence of not migrating to the new format.

Note: This will also prevent subtle breakage in case e.g the service annotation contains invalid DNS labels.

Checklist

  • Unit tests updated

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 10, 2022
@olemarkus
Copy link
Contributor Author

@Raffo / @szuecs would appreciate a review on this one. The issue with the record length is hitting us bad in production,

@szuecs
Copy link
Contributor

szuecs commented Oct 5, 2022

@olemarkus is this AWS specific?
If so it's likely not a good idea to do this change.
#2839 (comment) sounds also like a valid workaround.

@olemarkus
Copy link
Contributor Author

The 63 char limit is per https://www.ietf.org/rfc/rfc1034.txt.
E.g coredns will also refuse doing lookups if the label is longer than 63.

If we had new installations, we'd probably use a different prefix as that workaround, but setting it on our existing services will make external-dns lose ownership of all existing records. It would be a ton of work getting that cleaned up.

txtNew.WithSetIdentifier(r.SetIdentifier)
txtNew.ProviderSpecific = r.ProviderSpecific
} else {
return []*endpoint.Endpoint{txt}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we warn about this fallback is used?
I am not completely sure anymore about what behavior this will introduce in the long run.
I guess we loose only the ability to create other records of the same name, which seems ok for these kind of long records.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not using a subdomain for the prefix was a mistake, I think. And I guess that is the migration path for those that need e.g AAAA-records.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already warn in NewEndpoingWithTTL. Warning again is perhaps redundant?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, you are right with the return nil it's the same case :)
Subdomain can be used as far as I see by using --txt-prefix or --txt-suffix or example similar to what was written in #2839 (comment).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 6, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: olemarkus, szuecs

The full list of commands accepted by this bot can be found here.

The pull request process is described 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 6, 2022
@k8s-ci-robot k8s-ci-robot merged commit 644b880 into kubernetes-sigs:master Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. 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. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants