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

IAMPolicyMember locked hand on delete attempt #296

Closed
b4nst opened this issue Oct 29, 2020 · 2 comments
Closed

IAMPolicyMember locked hand on delete attempt #296

b4nst opened this issue Oct 29, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@b4nst
Copy link

b4nst commented Oct 29, 2020

Describe the bug
I made a typo in the version of the referenced IAM service account for an IAM policy member (v1alpha1 instead of v1beta1). Config connector correctly logged the error ([...] no match for kind IAMServiceAccount in version iam.cnrm.cloud.google.com/v1alpha1) but then the policy member could be deleted. kubectl delete logs that the iampolicymember has been deleted (it has not) and then hangs forever.

ConfigConnector Version
1.19.1

To Reproduce
Steps to reproduce the behavior:

  • kubectl apply -f sa.yml
  • kubectl delete iampolicymember gsa-wli

YAML snippets:

---
kind: IAMServiceAccount
apiVersion: iam.cnrm.cloud.google.com/v1beta1
metadata:
  name: gsa
spec:
  displayName: Google service account
---
kind: IAMPolicyMember
apiVersion: iam.cnrm.cloud.google.com/v1beta1
metadata:
  name: gsa-wli
spec:
  member: serviceAccount:project.svc.id.goog[default/ksa]
  role: roles/iam.workloadIdentityUser
  resourceRef:
    kind: IAMServiceAccount
# Typo next line, as it should be v1beta1
    apiVersion: iam.cnrm.cloud.google.com/v1alpha1
    name: gsa
@b4nst b4nst added the bug Something isn't working label Oct 29, 2020
@caieo
Copy link
Contributor

caieo commented Oct 30, 2020

Hi @b4nst, sorry you ran into this. It looks like IAMPolicyMembers spec is immutable and will return errors if you are trying to modify it (which was what you ran into). Unfortunately, you will need to delete and reapply the correct YAML.

In order to actually delete this faulty IAMPolicyMember, you can abandon the resource by adding & applying the cnrm.cloud.google.com/deletion-policy: abandon annotation to the original YAML. This will indicate to Config Connector that the resource should be abandoned instead of attempting to delete it. When you reapply the correct YAML, the resource will either be acquired (if it existed before) or created properly. Let me know if this works for you!

@b4nst
Copy link
Author

b4nst commented Oct 30, 2020

Oh that makes sense, I didn't think about abandoning it. Works fine, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants