Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS IAM: ensure cleanup of IAM roles using finalizer #97

Merged
merged 6 commits into from
Dec 7, 2023

Conversation

orishoshan
Copy link
Contributor

Description

Prior to this PR, in some circumstances, AWS IAM roles created by the credentials operator could be left dangling, when the operator was not available while the Pods and ServiceAccounts responsible for their creation were removed or modified.

Finalizers are now used to ensure that this doesn't happen.
Pods have a finalizer added to them in the pod webhook. This finalizer does the minimal amount of work - when a pod is terminating, it modifies a label on the linked ServiceAccount and removes the finalizer, or if the ServiceAccount no longer exists, it simply removes the finalizer. This is done to enable the pod to terminate as soon as possible.
The bulk of the work is done on the ServiceAccount, where IAM roles will be removed if it is labeled as having no related pods (by the pod reconciler's finalizer) or if the ServiceAccount itself is terminating.

References

Related: otterize/intents-operator#309

Testing

Describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

Please include any manual steps for testing end-to-end or functionality not covered by unit/integration tests.

Also include details of the environment this PR was developed in (language/platform/browser version).

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR and in github.com/otterize/docs

@orishoshan orishoshan enabled auto-merge (squash) December 7, 2023 17:42
@orishoshan orishoshan merged commit c541b5d into main Dec 7, 2023
4 checks passed
@orishoshan orishoshan deleted the orisho/ensure_iam_cleanup branch December 7, 2023 18:01
@github-actions github-actions bot locked and limited conversation to collaborators Dec 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants