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

AWS: change the order of the actions, DELETE before CREATE fixes #1411 #1555

Conversation

OmerKahani
Copy link
Contributor

@OmerKahani OmerKahani commented May 5, 2020

When adding an identifier to a record without an identifier, there should be a DELETE and then CREATE. Currently, external-dns will send the CREATE before the DELETE, that will fail the batch job with error:
"SetIdentifier hello-world cannot be created as a non-weighted set exists with the same name and type"

This PR solves this validation problem by changing the sort order so DELETE will be before CREATE. AWS doc states that the action will be happening in a single operation, so there shouldn't be a problem that only the DELETE was executed.
https://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html#API_ChangeResourceRecordSets_RequestSyntax

fixes #1411

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 5, 2020
@k8s-ci-robot k8s-ci-robot requested review from linki and Raffo May 5, 2020 13:57
@k8s-ci-robot
Copy link
Contributor

Welcome @OmerKahani!

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/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 5, 2020
@OmerKahani OmerKahani changed the title change the order of the actions fix #1411 change the order of the actions fixes #1411 May 5, 2020
@OmerKahani OmerKahani changed the title change the order of the actions fixes #1411 AWS\: change the order of the actions, DELETE before CREATE fixes #1411 May 5, 2020
@OmerKahani OmerKahani changed the title AWS\: change the order of the actions, DELETE before CREATE fixes #1411 AWS: change the order of the actions, DELETE before CREATE fixes #1411 May 5, 2020
@OmerKahani
Copy link
Contributor Author

/assign @hjacobs

@OmerKahani
Copy link
Contributor Author

/assign @Raffo

@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 added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 12, 2020
@OmerKahani OmerKahani force-pushed the Change_Order_Delete_Before_Create branch from 5f23ec9 to 231fbea Compare May 12, 2020 08:56
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 12, 2020
@Raffo
Copy link
Contributor

Raffo commented May 16, 2020

The changes look good, but given the change in semantic, I'd love to get some more feedback from people using ExternalDNS on AWS extensively.
I'm thinking of asking @njuettner @linki @szuecs for example, feel free to reply here if you have feedback to provide.

Can we have as well a sequence of steps to replicate #1411 @OmerKahani ?

@szuecs
Copy link
Contributor

szuecs commented May 16, 2020

Reading the docs, looks good to me, but one question I have is if the other cases that use sortChangesByActionNameType() are also fine with the change.

@OmerKahani
Copy link
Contributor Author

OmerKahani commented May 22, 2020

The changes look good, but given the change in semantic, I'd love to get some more feedback from people using ExternalDNS on AWS extensively.
I'm thinking of asking @njuettner @linki @szuecs for example, feel free to reply here if you have feedback to provide.

Can we have as well a sequence of steps to replicate #1411 @OmerKahani ?

The easiest way to replicate it is to create an ingress without the external-dns.alpha.kubernetes.io/set-identifier annotation, and then try to add the annotation

@OmerKahani
Copy link
Contributor Author

Reading the docs, looks good to me, but one question I have is if the other cases that use sortChangesByActionNameType() are also fine with the change.

this is the only place:
https://github.com/kubernetes-sigs/external-dns/search?q=sortChangesByActionNameType&unscoped_q=sortChangesByActionNameType

@szuecs
Copy link
Contributor

szuecs commented May 22, 2020

Then sortChangesByActionNameType() was unused and we should have a linter check.
@njuettner @Raffo do you know if you have a linter enabled to detect dead code?

@szuecs
Copy link
Contributor

szuecs commented May 22, 2020

I checked it and no we have not.
https://github.com/kubernetes-sigs/external-dns/blob/master/.golangci.yml#L15
We should stop using megacheck, because it’s deprecated and use staticcheck, which will become the default linter in go, as far as I know.

@OmerKahani
Copy link
Contributor Author

Then sortChangesByActionNameType() was unused and we should have a linter check.
@njuettner @Raffo do you know if you have a linter enabled to detect dead code?

Sorry, I meant it's not been used outside this function, it is been used in this function. if cs is bigger then batch size, the function will split cs to batches, and for every batch will run sortChangesByActionNameType().

@szuecs
Copy link
Contributor

szuecs commented May 26, 2020

I see and checked the code in the changed function. LGTM

@diogonicoleti
Copy link

diogonicoleti commented Jun 4, 2020

@linki @Raffo we use external-aws on AWS extensively and we're having this issue too.

For me it looks good. What we need to do to have this PR merged and released?If I could help with something feel free to ask.

@Raffo
Copy link
Contributor

Raffo commented Jun 10, 2020

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

[APPROVALNOTIFIER] This PR is APPROVED

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

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 10, 2020
@k8s-ci-robot k8s-ci-robot merged commit 102228c into kubernetes-sigs:master Jun 10, 2020
@diogonicoleti
Copy link

@Raffo thanks for merging this one! Do you have some idea when a new release with this fix will be released? We're waiting for it to fix some issues we're having in a production service.

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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AWS: Update record from simple routing policy to weighted is not supported
6 participants