There is a CRD for IAMCustomRole however it appears impossible to refer to a custom role from IAMPolicy and IAMPolicyMember, since the pattern for the role field is specified as ^roles/[\w\.]+$.
It would be useful to allow binding custom roles with paths like projects/<project id>/roles/<role id> or organization/<organization id>/roles/<role id> .
Hi ppennanen@, thanks for your feedback. I'll mark it as enhancement for this feature request. Ack that we should support binding custom roles.
@ppennanen As a temporary workaround, if you are blocked, we have confirmed that removing the pattern: ^roles/[\w\.]+$ restriction within the JSON schema for the IAMPolicy and IAMPolicyMember CRDs and using a relative resource name like projects/[PROJECT]/roles/[CUSTOM_ROLE] works.
You can do so via the following:
install-bundle/crds.yaml with: sed -i '/pattern: \^roles/d' install-bundle/crds.yamlOR
kubectl edit crd iampolicies.iam.cnrm.cloud.google.compattern: ^roles/[\w\.]+$ and delete itiampolicymembers.iam.cnrm.cloud.google.com instead of iampolicies.iam.cnrm.cloud.google.comNow something like this should work:
apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMPolicyMember
metadata:
name: iampolicymember-sample
spec:
member: user:[USER]@google.com
resourceRef:
kind: Project
role: projects/[PROJECT]/roles/iamcustomrolesample
Please note that our official support may look a bit different as we will want to be able to reference IAMCustomRole objects within the cluster as well.
Cool. Thank you!
If you want to maintain validation, you could also edit the regex like so:
pattern: ^(roles|projects)/[\w-/\.]+$
This isn't the most restrictive but gets the job done, it allows for - in project names too.
It will be great, to have this feature included. Any update is highly appreciated :-).
As the intent of IAMPolicy custom resource is to be full declaration at project level, and IAMPolicyMember is too granular for our use-case. It will be great to have this if IAMPolicyMember CR could refer to a custom role.
Else would it be appropriate to have IAMPolicyMemberMapping where one member could be mapped to multiple resources. I will raise a separate issue for this request.
Hi! 馃憢
With KCC 1.13.1 projects/[PROJECT]/roles/[CUSTOM_ROLE] are supported but it would be great if we had organizations/<organization id>/roles/<role id> as well.
The mentioned workaround worked for org level roles, but included support would be great!
Hi @regadas, sure thing, we'll add it to our backlog and let you know when we have updates.
This will be fixed in this week's release.
This should be fixed in version 1.19.1
Closing since issue has now been fixed.
Most helpful comment
Hi! 馃憢
With KCC
1.13.1projects/[PROJECT]/roles/[CUSTOM_ROLE]are supported but it would be great if we hadorganizations/<organization id>/roles/<role id>as well.The mentioned workaround worked for org level roles, but included support would be great!