-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat: Become IDNA aware in Plan and DomainFilter #4689
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
Hi @kimsondrup. 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 Once the patch is verified, the new status will be reflected by the 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. |
590af75
to
a26165c
Compare
Thanks for this PR @kimsondrup ! |
After looking at the code a bit more, I'm a little confused.
|
After looking at bit more at the code I think I will just summit the changes for registry/txt.go IDNA awareness in another pull request. @mloiseleur if this pull request looks good to you then I have nothing else to add. |
endpoint/domain_filter.go
Outdated
// normalizeDomain converts a domain to a canonical form, so that we can filter on it | ||
// it: trim "." suffix, get Unicode version of domain complient with Section 5 of RFC 5891 | ||
func normalizeDomain(domain string) string { | ||
s, _ := idna.Lookup.ToUnicode(strings.TrimSuffix(domain, ".")) |
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.
Wdyt about catching the error and, at least, log a warning ?
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.
The function is opinionated to return a partial string on errors (source) so I judged that we could get away with ignoring it, even if just to avoid log spam should something happen. But you we could log it as a warning
or debug
depending what you prefer?
🤔 If the prefix and suffix are applied before the idna |
Yes, I would also prefer a solution where prefix and suffix are applied before the IDNA Some providers might be IDNA aware themself so that I can imagine an External DNS playing around with prefix and suffix introducing some problems. Just an example of some results
I think that when adding the logic to registry/txt.go, it should also include some sane constraints on So, a "finished" implementation™ for IDNA awareness in External DNS should, IMHO, also handle whether a provider might normalize the domains themselves and then return either the Punycode, Unicode or the raw string used to create it, which could be a mix of the two2 at their discretion. To help with testing this, I would like the InMemory provider to support these three different behaviours so that they can be used in tests. I don't mind making all of this now that I am already invested in the task, but I would like that when the changelog says, "IDNA awareness now brings Unicode support", it is a thoroughly tested implementation. 1 I can't see a reason why anyone would prefix with 2 Example |
That sounds reasonable, yes 👍 .
🤔 Why would we want to enter in such a messy and complex world ? External Dns is maintained by very few people on their spare time, so we clearly need something as simple as possible. What about a switch like
Yes, sure 💯 ! |
Great point! |
Following KISS principle, I suggest to just add the feature in this PR and provide this additional feature to switch default in an other PR. You'll need to design it also for webhook providers. |
@mloiseleur I would like to remove the changes made to the The reason is that I am already prototyping the larger change with the switch and, in the process, realized that So my suggestion would be to let |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/lgtm |
Description
Ensure support for Internationalized Domain Names for Applications (aka. domains using Unicode) using golang.org/x/net/idna
Disclaimer, this is my first Go code so please look at it with extra skepticism
Checklist
End user documentation updated