-
Notifications
You must be signed in to change notification settings - Fork 62
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
Add checks for annotation to opt out of cluster owner RBAC #511
Add checks for annotation to opt out of cluster owner RBAC #511
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to add checks for creatorId
in the presence of no-creator-rbac
in cluster and project validators. Unfortunately the common. CheckCreatorID()
can't be used in those cases as it also checks if the creatorId
matches request.UserInfo.Username
which is not going to work (for projects for sure).
I've added a new function to common to check that only one of |
Issue: rancher/rancher#45591
Requires rancher/rancher changes: rancher/rancher#47259
Problem
When a service account creates a cluster, the project handler and cluster handler both attempt to create ClusterOwner and ProjectOwner roles and bind those roles to the service account. The problem is that we don't support those roles for service accounts, so the logs get flooded with errors as it keeps retrying to add those roles.
Solution
To avoid the errors and the re-queuing, we have added a new annotation
field.cattle.io/no-creator-rbac
. When it is set the webhook does not set thefield.cattle.io/creatorId
annotation to clusters because the controllers will no longer be creating RBAC for the creator of the cluster.I moved some annotations to the
common
package as I felt it was more apt. I also cleaned up some functions in thecommon
package to make them more consistent.CheckList