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

Prevent plan reporting endpoint target casing differences as a change #1960

Merged
merged 5 commits into from
Feb 17, 2021

Conversation

robselway
Copy link
Contributor

@robselway robselway commented Feb 14, 2021

Description

Fix to prevent the plan reporting a difference in endpoint target casing as a change that needs to be made. This fixes a bug that has so far been identified in the Cloudflare provider where uppercase characters in the external-dns.alpha.kubernetes.io/target attribute can cause a CREATE/DELETE loop.

I have addressed the issue as centrally as possible to prevent dependencies on the core plan logic needing to think about this scenario, however the trade-off it a performance hit where !strings.EqualFold() is more expensive than the previous != operation, and would be more expensive than performing a strings.ToLower() at the edge (e.g. in source). Happy to change this if we think it's too much.

Fixes #1906

Checklist

  • Unit tests updated

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 14, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @robselway!

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 k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 14, 2021
@Raffo
Copy link
Contributor

Raffo commented Feb 14, 2021

@robselway thank you for your PR, this sounds like an easy fix for a nasty problem. Frankly, I don't think performance matter in this case, but I do have a question: is it enough to handle the case problem in this single comparison or would it be handy to convert to lowercase to be useful to other parts of the code? I'm thinking that the answer is "no, this is enough", but I'd love to hear your thoughts given that you took a look at the problem.

@robselway
Copy link
Contributor Author

Thanks @Raffo. I think this change should be enough to handle it, but it could be worth converting to lowercase in source when we fetch the value from the attribute - it could potentially prevent some other bugs, assuming other providers store values in lowercase like Cloudflare does.

My only reservation is RFC 1035 - 3.3.3 (linked to by @jgrumboe in the original issue) that says:

When data enters the domain system, its original case should be preserved whenever possible.

...

Loss of case sensitive data must be minimized.

So if we're sticking close to the spec, we should minimize any transformations and look to compare strings in a case-insensitive manner wherever possible?

@Raffo
Copy link
Contributor

Raffo commented Feb 17, 2021

You are right @robselway . Merging as is.

@Raffo
Copy link
Contributor

Raffo commented Feb 17, 2021

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Raffo, robselway

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 Feb 17, 2021
@k8s-ci-robot k8s-ci-robot merged commit aafb4bf into kubernetes-sigs:master Feb 17, 2021
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/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.

Upper-case CNAME target causing constantly creation and deletion on Cloudflare
3 participants