🐛 fix: clean up orphaned ENIs before subnet deletion at teardown#6073
Conversation
|
/test pull-cluster-api-provider-aws-e2e |
3 similar comments
|
/test pull-cluster-api-provider-aws-e2e |
|
/test pull-cluster-api-provider-aws-e2e |
|
/test pull-cluster-api-provider-aws-e2e |
After NLB deletion, AWS asynchronously cleans up the NLB's cross-AZ ENIs, which can take up to 1 hour. CAPA proceeds immediately to SG/subnet deletion with no ENI cleanup step, causing DependencyViolation errors that block cluster deletion until the e2e test times out. Add a deleteOrphanedENIs() step in DeleteNetwork(), before subnet deletion. It discovers ENIs in the VPC that are in "available" state and reference the cluster's security groups, then deletes them. This targets exactly the ENIs blocking SG/subnet deletion without touching other clusters' ENIs. Signed-off-by: Damiano Donati <damiano.donati@gmail.com>
fbbe945 to
baaa412
Compare
|
full e2es passed 5 times in a row: https://prow.k8s.io/pr-history/?org=kubernetes-sigs&repo=cluster-api-provider-aws&pr=6073 |
|
/assign @richardcase @dlipovetsky @AndiDog @nrb @clebs |
|
/test pull-cluster-api-provider-aws-e2e |
b6cc2c7 to
b50a84c
Compare
|
/test pull-cluster-api-provider-aws-e2e-blocking |
|
/test pull-cluster-api-provider-aws-e2e |
|
/lgtm |
|
LGTM label has been added. DetailsGit tree hash: 21c960c01953b683f99f4b10a068790c8e49785b |
nrb
left a comment
There was a problem hiding this comment.
One missed context.TODO(), otherwise 👍
| eniID := aws.ToString(eni.NetworkInterfaceId) | ||
| s.scope.Debug("Deleting orphaned network interface", "eni-id", eniID) | ||
|
|
||
| if _, err := s.EC2Client.DeleteNetworkInterface(context.TODO(), &ec2.DeleteNetworkInterfaceInput{ |
There was a problem hiding this comment.
| if _, err := s.EC2Client.DeleteNetworkInterface(context.TODO(), &ec2.DeleteNetworkInterfaceInput{ | |
| if _, err := s.EC2Client.DeleteNetworkInterface(ctx, &ec2.DeleteNetworkInterfaceInput{ |
ENI deletion operations now consistently use the passed reconciliation context instead of context.TODO(), ensuring proper timeout semantics throughout the entire ENI cleanup phase.
|
@damdo: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions 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-sigs/prow repository. I understand the commands that are listed here. |
|
/test pull-cluster-api-provider-aws-e2e |
|
/test pull-cluster-api-provider-aws-build-docker |
|
build-docker is ooming, I've created: kubernetes/test-infra#37376 |
|
/test pull-cluster-api-provider-aws-build-docker |
|
/lgtm Re-tagging after fixing docker OOM issue. |
|
LGTM label has been added. DetailsGit tree hash: bf3a730ae5f5bb3bfc6be1e7b74f4043be8ee531 |
|
/test pull-cluster-api-provider-aws-e2e-eks |
|
/unhold |
b33921c
into
kubernetes-sigs:main
|
/cherry-pick release-2.11 |
|
@damdo: new pull request created: #6091 DetailsIn response to this:
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-sigs/prow repository. |
What type of PR is this?
/kind bug
What this PR does / why we need it:
After NLB deletion during cluster teardown, AWS asynchronously cleans up the NLB's cross-AZ ENIs, a process that can take up to 1 hour. CAPA proceeds immediately to security group and subnet deletion with no ENI cleanup step, causing
DependencyViolationerrors that block cluster deletion until the e2e test times out.This PR adds a
deleteOrphanedENIs()step inDeleteNetwork(), right before subnet deletion. It discovers ENIs in the VPC that are:availablestate (not attached to any instance or service)This targets exactly the ENIs blocking SG/subnet deletion without touching other clusters' ENIs sharing the same VPC.
Which issue(s) this PR fixes:
Fixes #6067
Special notes for your reviewer:
The ENI cleanup is non-fatal: if it fails, the error is logged and subnet deletion proceeds (which will fail with
DependencyViolationand trigger a requeue, as before). On the next reconcile, the ENIs that have since becomeavailableare cleaned up, unblocking both SG and subnet deletion.No new service factory, interface, or controller wiring is needed, the implementation lives entirely in the existing network service's
DeleteNetwork()flow.Checklist:
Release note: