fix: revoke cross-referencing SG rules before deletion in cleanup#766
Merged
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom Mar 31, 2026
Merged
Conversation
Security groups that reference each other (e.g., CP SG allows traffic from Worker SG and vice versa) cannot be deleted due to AWS DependencyViolation errors. Revoke all ingress/egress rules before attempting deletion to break the circular dependency. This fixes the periodic cleanup failing on 2 remaining VPCs in us-west-1 that had cross-referencing CP/Worker security groups. Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
This was referenced Mar 31, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
VPC cleanup fails with
DependencyViolationwhen security groups reference each other. This happens with HA clusters that have separate CP and Worker security groups — each SG has ingress rules allowing traffic from the other SG.Evidence: Periodic cleanup run #554 in us-west-1 — 2 VPCs stuck with cross-referencing SGs:
sg-0b56fe8d5b8d64719↔sg-0beb33ad189a9a7dfandsg-0350efe7ea4492291↔sg-0054c36ffad2fa8d4.Fix
Revoke all ingress/egress rules from non-default SGs before attempting deletion. This breaks the circular dependency so
DeleteSecurityGroupsucceeds.Changes
pkg/cleanup/cleanup.go: AddRevokeSecurityGroupIngress/RevokeSecurityGroupEgresscalls indeleteSecurityGroups()before the delete looppkg/cleanup/cleanup_ginkgo_test.go: Add test with cross-referencing CP/Worker SGspkg/testutil/mocks/aws.go: Add configurable func fields for Revoke methodsTesting