Skip to content

Conversation

@vivekr-splunk
Copy link
Collaborator

Clean Up AWS Resources After Cluster Deletion

Description

This PR introduces automation to clean up any remaining AWS resources, specifically Security Groups and OIDC IDs, after a Kubernetes cluster deletion. The objective is to ensure no orphaned resources are left behind once the pipeline completes, preventing unnecessary resource usage and avoiding potential security risks associated with leftover configurations.

Changes

  • Implemented logic to delete AWS Security Groups associated with the cluster after deletion.
  • Added cleanup for OIDC ID to remove any lingering identity provider configurations post-cluster deletion.
  • Ensured the cleanup process runs at the end of the pipeline to capture any residual resources after all steps have completed.

Why This Is Needed

Leaving behind AWS Security Groups and OIDC configurations can lead to:

  • Increased Costs: Unused resources incur costs if not removed.
  • Security Risks: Unused Security Groups and identity configurations may expose the account to unauthorized access.
  • Resource Clutter: Keeping a clean environment is crucial for maintaining accurate and effective resource management.

Testing

  • Verified that Security Groups are correctly identified and deleted after cluster deletion.
  • Tested OIDC ID removal in different scenarios to ensure compatibility with existing workflows.
  • Confirmed no resources remain after pipeline completion.

Additional Notes

Please review the resource deletion logic to ensure it aligns with existing resource tagging conventions and does not inadvertently delete in-use resources in shared environments.


This PR will help maintain a clean AWS environment and improve resource efficiency in our CI/CD pipeline.

@vivekr-splunk vivekr-splunk requested a review from akondur November 8, 2024 17:40
@vivekr-splunk vivekr-splunk self-assigned this Nov 8, 2024
Copy link
Collaborator

@akondur akondur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@akondur akondur self-requested a review November 12, 2024 17:42
Signed-off-by: vivekr-splunk <[email protected]>
@vivekr-splunk
Copy link
Collaborator Author

vivekr-splunk commented Nov 12, 2024 via email

Signed-off-by: vivekr-splunk <[email protected]>
@akondur
Copy link
Collaborator

akondur commented Nov 12, 2024 via email

@vivekr-splunk vivekr-splunk merged commit 7127f60 into develop Nov 18, 2024
19 checks passed
@patrykw-splunk patrykw-splunk deleted the cleanup-sg-oidc branch December 5, 2025 13:56
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.

2 participants