Skip to content

fix: revoke cross-referencing SG rules before deletion in cleanup#766

Merged
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom
ArangoGutierrez:fix/sg-cross-reference-cleanup
Mar 31, 2026
Merged

fix: revoke cross-referencing SG rules before deletion in cleanup#766
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom
ArangoGutierrez:fix/sg-cross-reference-cleanup

Conversation

@ArangoGutierrez
Copy link
Copy Markdown
Collaborator

Problem

VPC cleanup fails with DependencyViolation when 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-0b56fe8d5b8d64719sg-0beb33ad189a9a7df and sg-0350efe7ea4492291sg-0054c36ffad2fa8d4.

Fix

Revoke all ingress/egress rules from non-default SGs before attempting deletion. This breaks the circular dependency so DeleteSecurityGroup succeeds.

Changes

  • pkg/cleanup/cleanup.go: Add RevokeSecurityGroupIngress/RevokeSecurityGroupEgress calls in deleteSecurityGroups() before the delete loop
  • pkg/cleanup/cleanup_ginkgo_test.go: Add test with cross-referencing CP/Worker SGs
  • pkg/testutil/mocks/aws.go: Add configurable func fields for Revoke methods

Testing

  • 83/83 cleanup tests pass
  • New test verifies: ingress revoked → egress revoked → SGs deleted

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>
@ArangoGutierrez ArangoGutierrez merged commit c62e351 into NVIDIA:main Mar 31, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant