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

Allow for custom property comparators #1536

Merged
merged 6 commits into from
Jun 1, 2020

Conversation

sheerun
Copy link
Contributor

@sheerun sheerun commented Apr 16, 2020

It build on top of #1534 and fixes #1463 with the same base idea but (allow providers to define their property comparator) but also enhancements from #1534 which this PR succeeds. The main changes are:

  1. Added tests to plan_test.go that verify logic in general case
  2. Added tests to cloudflare_test.go that actually test this issue is fixed
  3. Renamed "Attribute" to "Property" to be consistent with "ProviderSpecificProperty"
  4. Comparator is passed as one of Plan attributes instead of being passed to Calculate
  5. Signature of property comparator changed from func (string, *string, *string) bool to func (string, string, string) bool to avoid issues with improper handling of nil values (with current signature empty string is treated the same way as nil value, if there is a need to treat them differently in the future, the signature can be of course changed back).
  6. Simplified shouldUpdateProviderSpecific code and made it O(n)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 16, 2020
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 16, 2020
@sheerun
Copy link
Contributor Author

sheerun commented Apr 16, 2020

/assign @njuettner

@sheerun
Copy link
Contributor Author

sheerun commented Apr 17, 2020

I've checked this change in live application and it seems to be working

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 5, 2020
@sheerun
Copy link
Contributor Author

sheerun commented May 6, 2020

It's rebased and ready to be reviewed

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 11, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 12, 2020
@sheerun
Copy link
Contributor Author

sheerun commented May 12, 2020

rebased

Fixes issue kubernetes-sigs#1463

Co-authored-by: Alastair Houghton <alastair@alastairs-place.net>
@sheerun
Copy link
Contributor Author

sheerun commented May 13, 2020

/assign @Raffo

@sheerun
Copy link
Contributor Author

sheerun commented May 22, 2020

@tariq1890 @ytsarev Maybe you want to review this one as well? It allows any provider to define custom comparators which can help with custom properties or bugs that cause repeated updates

Copy link
Contributor

@Raffo Raffo left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @sheerun , I think that's great! I added a few comments, but I think overall this is good to ship.
Did you test an image with that? We are aiming at a release of externalDNS next week and I want to make sure that this would be good to ship in case we get it in.

plan/plan.go Show resolved Hide resolved
plan/plan.go Show resolved Hide resolved
plan/plan.go Outdated Show resolved Hide resolved
@sheerun
Copy link
Contributor Author

sheerun commented May 30, 2020

@Raffo I fixed your suggestions, mind to approve? :)

@sheerun
Copy link
Contributor Author

sheerun commented May 30, 2020

/lgtm

@k8s-ci-robot
Copy link
Contributor

@sheerun: you cannot LGTM your own PR.

In response to this:

/lgtm

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/test-infra repository.

Copy link
Contributor

@Raffo Raffo left a comment

Choose a reason for hiding this comment

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

Sorry for nit-picking, here's a few more suggestions.

plan/plan.go Outdated Show resolved Hide resolved
plan/plan.go Outdated Show resolved Hide resolved
sheerun and others added 2 commits May 31, 2020 20:07
Co-authored-by: Raffaele Di Fazio <raffo@github.com>
Co-authored-by: Raffaele Di Fazio <raffo@github.com>
@sheerun
Copy link
Contributor Author

sheerun commented May 31, 2020

No problem, updated

@Raffo
Copy link
Contributor

Raffo commented Jun 1, 2020

Restarting the tests.

@Raffo
Copy link
Contributor

Raffo commented Jun 1, 2020

The failure seems to be a legit one @sheerun :

plan/plan.go:24:2: imported and not used: "github.com/sirupsen/logrus" as log

can you please fix it?

@Raffo
Copy link
Contributor

Raffo commented Jun 1, 2020

/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 Jun 1, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Jun 1, 2020
@k8s-ci-robot k8s-ci-robot merged commit 25d71ea into kubernetes-sigs:master Jun 1, 2020
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloudflare provider causes repeated UPDATE
4 participants