feat: cleanup dual security groups on cluster delete#726
Merged
ArangoGutierrez merged 2 commits intoNVIDIA:mainfrom Mar 14, 2026
Merged
feat: cleanup dual security groups on cluster delete#726ArangoGutierrez merged 2 commits intoNVIDIA:mainfrom
ArangoGutierrez merged 2 commits intoNVIDIA:mainfrom
Conversation
Delete flow handles both CP and Worker security groups. Worker SG deleted before CP SG to respect reference dependency. Empty SG IDs handled gracefully for single-node backward compatibility. IAM instance profile cleanup deferred to Wave 3 (no IAM client yet). Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Pull Request Test Coverage Report for Build 23065195191Details
💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
This PR improves AWS cluster teardown in Holodeck by correctly cleaning up multiple security groups (worker/control-plane/shared) during delete, handling backward-compatible empty IDs, and adding targeted unit tests.
Changes:
- Reordered security group deletion to remove the Worker SG before the Control Plane SG to respect dependency constraints.
- Added a
deleteSecurityGroup()helper to centralize retry/backoff + empty/not-found handling. - Added unit tests covering deletion ordering and empty/not-found edge cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pkg/provider/aws/delete.go | Implements ordered multi-SG deletion and introduces deleteSecurityGroup() helper; adds Wave 3 TODO for IAM cleanup. |
| pkg/provider/aws/delete_test.go | Adds unit tests for dual-SG ordering plus empty/not-found cases; introduces a minimal Environment helper for condition updates. |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
317
to
+323
| // Verify deletion | ||
| time.Sleep(verificationDelay) | ||
| if p.securityGroupExists(cache.SecurityGroupid) { | ||
| return fmt.Errorf("security group %s still exists after deletion", cache.SecurityGroupid) | ||
| if p.securityGroupExists(sgID) { | ||
| return fmt.Errorf("security group %s (%s) still exists after deletion", sgID, label) | ||
| } | ||
|
|
||
| p.log.Info("Security group %s successfully deleted", cache.SecurityGroupid) | ||
| p.log.Info("Security group %s (%s) successfully deleted", sgID, label) |
Comment on lines
+399
to
+403
| env := testEnvironment() | ||
| provider := &Provider{ | ||
| ec2: mock, | ||
| log: mockLogger(), | ||
| Environment: env, |
Comment on lines
+444
to
+448
| provider := &Provider{ | ||
| ec2: mock, | ||
| log: mockLogger(), | ||
| Environment: env, | ||
| } |
Comment on lines
+469
to
+472
| provider := &Provider{ | ||
| log: mockLogger(), | ||
| Environment: env, | ||
| } |
When SecurityGroupid == CPSecurityGroupid (single-node clusters that reuse the CP SG as shared), skip the redundant shared SG delete to prevent a double-delete error. Add test for this edge case. Signed-off-by: Eduardo Aguilar <eduardoa@nvidia.com> Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
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.
Summary
deleteSecurityGroup()helper with retry/backoffTest plan
go vet ./...clean