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

Disassociate secondary CIDR after subnets are deleted #3347

Merged

Conversation

Ankitasw
Copy link
Member

@Ankitasw Ankitasw commented Mar 24, 2022

What type of PR is this?
/kind bug

What this PR does / why we need it:
This PR fixes following:

  • Order of disassociation of secondary CIDR post subnet deletion, otherwise the CIDR wont get deleted if subnet is still in use.
  • Adds ec2:AssociateVpcCidrBlock and ec2:DisassociateVpcCidrBlock permissions to EKS controller policy.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #3277
Fixes #3273

Checklist:

  • squashed commits
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

Release note:

- Disassociate secondary CIDR after subnets are deleted.
- Adds ec2:AssociateVpcCidrBlock and ec2:DisassociateVpcCidrBlock permissions to EKS controller policy.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 24, 2022
@k8s-ci-robot
Copy link
Contributor

@Ankitasw: This issue is currently awaiting triage.

If CAPA/CAPI contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 24, 2022
@Ankitasw
Copy link
Member Author

/test pull-cluster-api-provider-aws-e2e-eks

@sedefsavas
Copy link
Contributor

LGTM.

Wondering if you confirmed without this fix, the new e2e changes fail? So that we will know that the test is actually catching the current bug.

@Ankitasw
Copy link
Member Author

Wondering if you confirmed without this fix, the new e2e changes fail? So that we will know that the test is actually catching the current bug.

I will confirm it locally.

@Ankitasw Ankitasw changed the title Disassociate secondary CIDR after subnets are deleted [WIP] Disassociate secondary CIDR after subnets are deleted Mar 25, 2022
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 25, 2022
@Ankitasw Ankitasw force-pushed the handle-secondary-cidr-delete branch from 5db42cb to 37f0b68 Compare March 25, 2022 06:40
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 25, 2022
@Ankitasw
Copy link
Member Author

/test pull-cluster-api-provider-aws-e2e-eks

@Ankitasw Ankitasw changed the title [WIP] Disassociate secondary CIDR after subnets are deleted Disassociate secondary CIDR after subnets are deleted Mar 25, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 25, 2022
@Ankitasw
Copy link
Member Author

/hold
until tests passes

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 25, 2022
@Ankitasw
Copy link
Member Author

Ankitasw commented Mar 25, 2022

@sedefsavas confirmed below error with existing code if secondary CIDR block is provided:

Reconciler error" "error"="InvalidCidrBlock.InUse: The vpc vpc-0232ce4e5a6e2c91a currently has a subnet within CIDR block 100.64.0.0/16\n\tstatus code: 400, request id: 3daf9588-4c1c-490e-8ec6-15a0d700b5fd" "name"="cluster-onrwy3-control-plane" "namespace"="eks-nodes-bmzl58" "reconciler group"="controlplane.cluster.x-k8s.io" "reconciler kind"="AWSManagedControlPlane"

Also added necessary permissions to controllers policy.

@Ankitasw
Copy link
Member Author

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 25, 2022
@Ankitasw Ankitasw force-pushed the handle-secondary-cidr-delete branch from 37f0b68 to 67b5738 Compare March 28, 2022 08:25
@Ankitasw
Copy link
Member Author

This PR is ready for review.

@sedefsavas
Copy link
Contributor

Since Secondary CIDR is only supported in EKS, we should not add the permissions for associate/disassociate VPC CIDRs when EKS is disabled in the clusterawsadm config file.

@Ankitasw
Copy link
Member Author

@sedefsavas will make the desired change.

@Ankitasw Ankitasw force-pushed the handle-secondary-cidr-delete branch from 67b5738 to 593eb63 Compare March 29, 2022 07:07
@Ankitasw
Copy link
Member Author

/test pull-cluster-api-provider-aws-e2e-eks

@Ankitasw
Copy link
Member Author

Since Secondary CIDR is only supported in EKS, we should not add the permissions for associate/disassociate VPC CIDRs when EKS is disabled in the clusterawsadm config file.

Made the changes, ready for review again.

@sedefsavas
Copy link
Contributor

/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 Mar 30, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sedefsavas

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 Mar 30, 2022
@Ankitasw
Copy link
Member Author

/retest

@Ankitasw Ankitasw force-pushed the handle-secondary-cidr-delete branch from 593eb63 to f6a4928 Compare March 30, 2022 04:44
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 30, 2022
@Ankitasw
Copy link
Member Author

@sedefsavas the test was failing as new fixture with_s3_bucket.yaml was added in main branch and didn't have the vpc cidr permissions, added those permissions now.

@sedefsavas sedefsavas added this to the v1.4.0 milestone Mar 30, 2022
@sedefsavas
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 30, 2022
@k8s-ci-robot k8s-ci-robot merged commit f68a146 into kubernetes-sigs:main Mar 30, 2022
@k8s-ci-robot k8s-ci-robot modified the milestones: v1.4.0, v1.x Mar 30, 2022
@Ankitasw Ankitasw deleted the handle-secondary-cidr-delete branch March 31, 2022 16:24
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. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
3 participants