Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions test/iam/user-deletion-garbage-collection/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Test: `user-deletion-garbage-collection`

Validates that User resource deletion properly triggers garbage collection of associated
PolicyBinding and UserPreference resources. This test ensures the webhook creates resources
with correct owner references and the controller adds them post-creation, allowing
Kubernetes garbage collector to clean them up when the User is deleted.

PolicyBinding and UserPreference resources. Additionally, as of the current controller logic, the UserController now adds a `iam.miloapis.com/user-membership-cleanup` finalizer to every User. When the User is deleted, the controller explicitly finds and deletes all OrganizationMembership resources referencing that User before completing User deletion. This ensures all related OrganizationMemberships are removed alongside the User, instead of relying solely on Kubernetes garbage collection via owner references.

## Steps

Expand All @@ -29,7 +26,10 @@ Create a User resource and verify webhook creates associated resources

### Step: `delete-user`

Delete the User resource and verify associated resources are garbage collected
Delete the User resource and verify associated resources are garbage collected or explicitly deleted by the controller

- When the User resource is deleted, the UserController first removes all referenced OrganizationMembership resources via the `user-membership-cleanup` finalizer.
- PolicyBinding and UserPreference resources with ownerReferences pointing to the User are cleaned up by Kubernetes garbage collection as before.

#### Try

Expand All @@ -42,4 +42,3 @@ Delete the User resource and verify associated resources are garbage collected
| 5 | `error` | 0 | 0 | *No description* |

---