-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(zonefinder): transform zone name to unicode as well #5980
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
base: master
Are you sure you want to change the base?
Conversation
|
Hi @rbeuque74. Thanks for your PR. I'm waiting for a github.com 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. |
1e40bf3 to
edc5d84
Compare
|
/ok-to-test |
Pull Request Test Coverage Report for Build 19746205961Details
💛 - Coveralls |
Signed-off-by: Romain Beuque <[email protected]>
edc5d84 to
682e59f
Compare
|
@feluxe Do you think you can test this PR and confirm if it fixes your issue ? |
|
/lgtm |
| _, zoneName := zoneNameIDMapper.FindZone(endpt.DNSName) | ||
| zoneName, _ := zoneNameIDMapper.FindZone(endpt.DNSName) | ||
| if zoneName == "" { | ||
| return nil, provider.NewSoftError(fmt.Errorf("record %q have not found matching DNS zone in OVH provider", endpt.DNSName)) |
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.
| return nil, provider.NewSoftError(fmt.Errorf("record %q have not found matching DNS zone in OVH provider", endpt.DNSName)) | |
| return nil, provider.NewSoftErrorf("record %q have not found matching DNS zone in OVH provider", endpt.DNSName) |
| _, zoneName := zoneNameIDMapper.FindZone(endpt.DNSName) | ||
| zoneName, _ := zoneNameIDMapper.FindZone(endpt.DNSName) | ||
| if zoneName == "" { | ||
| return nil, provider.NewSoftError(fmt.Errorf("record %q have not found matching DNS zone in OVH provider", endpt.DNSName)) |
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.
same NewSoftErrorf
| } | ||
|
|
||
| func convertDNSNameIntoSubDomain(DNSName string, zoneName string) string { // nolint: gocritic // captLocal | ||
| if name, err := idna.Profile.ToUnicode(DNSName); err == nil { |
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.
why not to first
if DNSName == zoneName {
return ""
}
and only then execute idna normalisation?
I have tried
func convertDNSNameIntoSubDomain(DNSName string, zoneName string) string { // nolint: gocritic // captLocal
if DNSName == zoneName {
return ""
}
if name, err := idna.Profile.ToUnicode(DNSName); err == nil {
DNSName = name
}
if name, err := idna.Profile.ToUnicode(zoneName); err == nil {
zoneName = name
}
return strings.TrimSuffix(DNSName, "."+zoneName)
}All tests still green, either required a test that will fail or we could do the fastest check first.
|
[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 |
| _, zoneName := zoneNameIDMapper.FindZone(endpt.DNSName) | ||
| zoneName, _ := zoneNameIDMapper.FindZone(endpt.DNSName) | ||
| if zoneName == "" { | ||
| return nil, provider.NewSoftError(fmt.Errorf("record %q have not found matching DNS zone in OVH provider", endpt.DNSName)) |
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.
same NewSoftErrorf
| _, zoneName := zoneNameIDMapper.FindZone(endpt.DNSName) | ||
| zoneName, _ := zoneNameIDMapper.FindZone(endpt.DNSName) | ||
| if zoneName == "" { | ||
| return nil, provider.NewSoftError(fmt.Errorf("record %q have not found matching DNS zone in OVH provider", endpt.DNSName)) |
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.
same NewSoftErrorf
What does it do ?
This change fix a different of behaviour inside provider/zone_finder.
Record name are converted to unicode, while zone name were not converted as unicode when inserted, leading to inconsistencies.
Motivation
Fixes #5914
With #5147, external-dns now handle IDNA zone name, and zone_finder is handling them as unicode.
But, if a provider pushes a zone name punnyencoded, and not using unicode, the find function is not handing it correctly.
More