AWSClusterRoleIdentity can be deleted when its still referenced
#2,371 opened on Apr 23, 2021
Repository metrics
- Stars
- (723 stars)
- PR merge metrics
- (PR metrics pending)
Description
/kind bug
What steps did you take and what happened:
When deleting a cluster, which is using the new AWS multitenancy (https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/2253) CR AWSClusterRoleIdentity referenced in AWSCuster.spec.identityRef, you can accidentally delete the Role resource and the whole deletion process will fail, because the controller doesn't know how to access the AWS API.
What did you expect to happen:
AWSClusterRoleIdentity would have finalizer set on to prevent deletion ( or ownerReferences: to block deletion), until there is no identity reference on it (no AWSCluster is pointing to it)
Anything else you would like to add:
I have not tested this with AWSClusterStaticIdentity and AWSClusterControllerIdentity but there could be similar behavior
Environment:
- Cluster-api-provider-aws version: 0.6.5
- Kubernetes version: (use
kubectl version): 1.19.8