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

Don't try to delete ElasticIPs of NatGateway is shared #7525

Merged
merged 1 commit into from
Sep 6, 2019

Conversation

dzoeteman
Copy link
Contributor

Right now, if a NatGateway is shared, kops will still try to remove ElasticIPs associated to the NatGateway when trying to delete a cluster. These ElasticIPs don't have any ownership tags.

This will never work, as kops is not deleting the NatGateway, and it shouldn't anyway, since kops doesn't own the ElasticIP.

Fixed this by not checking for ElasticIPs when trying to delete a shared NatGateway.
Tested that with an owned NatGateway, the associated Elastic IP is still deleted.

@k8s-ci-robot k8s-ci-robot added 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 Sep 6, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @dzoeteman. Thanks for your PR.

I'm waiting for a kubernetes 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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 6, 2019
@dzoeteman
Copy link
Contributor Author

/assign @mikesplain

@@ -1339,7 +1339,13 @@ func FindNatGateways(cloud fi.Cloud, routeTables map[string]*resources.Resource,
natGatewayId := aws.StringValue(ngw.NatGatewayId)

forceShared := !ownedNatGatewayIds.Has(natGatewayId)
resourceTrackers = append(resourceTrackers, buildNatGatewayResource(ngw, forceShared, clusterName))
ngwResource := buildNatGatewayResource(ngw, forceShared, clusterName)
resourceTrackers = append(resourceTrackers, ngwResource)
Copy link
Member

Choose a reason for hiding this comment

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

did you test this? Now you are skipping only elastic ip deletion? Are you sure that nat gateway is not going to be deleted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did you test this? Now you are skipping only elastic ip deletion? Are you sure that nat gateway is not going to be deleted

Yes, because the nat gateway is correctly tagged with ownership tag. I tested both scenarios:
1: Nat gateway owned: nat gateway deleted, elastic IP deleted
2: Nat gateway shared: nat gateway not deleted, elastic IP not deleted

Copy link
Member

@zetaab zetaab left a comment

Choose a reason for hiding this comment

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

/ok-to-test
/lgtm

@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. lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 6, 2019
@mikesplain
Copy link
Contributor

Makes sense to me, nice approach @dzoeteman! Thanks for the PR!
Thanks for the review @zetaab!

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dzoeteman, mikesplain

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 Sep 6, 2019
@k8s-ci-robot k8s-ci-robot merged commit 32b6adc into kubernetes:master Sep 6, 2019
@dzoeteman dzoeteman deleted the elastic-ip-shared branch September 7, 2019 07:46
@dzoeteman
Copy link
Contributor Author

Thanks @mikesplain & @zetaab! Is it possible to get this into 1.14 too? Would allow us to get our kops pipeline automated - that would be fantastic :)

@zetaab
Copy link
Member

zetaab commented Sep 7, 2019

Please make cherry pick PR?

@dzoeteman
Copy link
Contributor Author

Please make cherry pick PR?

Done :)

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

4 participants