Skip to content

Conversation

@rbeuque74
Copy link
Contributor

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

  • Yes, this PR title follows Conventional Commits
  • Yes, I added unit tests
  • Yes, I updated end user documentation accordingly

@k8s-ci-robot k8s-ci-robot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Nov 27, 2025
@k8s-ci-robot k8s-ci-robot added provider Issues or PRs related to a provider 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. labels Nov 27, 2025
@k8s-ci-robot
Copy link
Contributor

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 /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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 27, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Nov 27, 2025
@ivankatliarchuk
Copy link
Member

/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 27, 2025
@coveralls
Copy link

coveralls commented Nov 27, 2025

Pull Request Test Coverage Report for Build 19746205961

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 42 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.04%) to 78.63%

Files with Coverage Reduction New Missed Lines %
zonefinder.go 3 90.0%
ovh/ovh.go 39 91.75%
Totals Coverage Status
Change from base Build 19598374265: -0.04%
Covered Lines: 15969
Relevant Lines: 20309

💛 - Coveralls

@mloiseleur mloiseleur changed the title fix: provider/FindZone: transform zone name to unicode as well fix(zonefinder): transform zone name to unicode as well Nov 28, 2025
@mloiseleur
Copy link
Collaborator

@feluxe Do you think you can test this PR and confirm if it fixes your issue ?

@mloiseleur
Copy link
Collaborator

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 5, 2025
_, 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))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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))
Copy link
Member

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 {
Copy link
Member

@ivankatliarchuk ivankatliarchuk Dec 7, 2025

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.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 7, 2025
@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 ask for approval from mloiseleur. 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

_, 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))
Copy link
Contributor

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

Choose a reason for hiding this comment

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

same NewSoftErrorf

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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. provider Issues or PRs related to a provider 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.

OVHcloud API error (status code 404): Client::NotFound: \"Got an invalid (or empty) URL

6 participants