[Bug] Installing as a lower privileged user in namespace-scoped mode fails due to cluster-scoped resources in generated Role #1330
Labels
bug
Something isn't working
help wanted
Extra attention is needed
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
Describe the bug
TokenReviews
andSubjectAccessReviews
permissions are not needed in theRole
generated when running in namespace-scoped mode.On our multitenant Kubernetes cluster, standard users only have the
Admin
role over the scope of their namespaces and cannot create resources at the cluster scope. When a user tries to install this chart in namespace-scoped mode, the generatedRole
andRoleBinding
try to assign permissions on theTokenReviews
andSubjectAccessReviews
resources, which the user does not have so the request gets blocked. Since these are cluster-scoped resources, it makes more sense to just disable these rules in the generatedRole
conditionally.Version
v5.5.2
To Reproduce
Steps to reproduce the behavior:
kubectl
such that your are connecting to a cluster as someone who does not haveadmin
permissions at the cluster scope.helm upgrade -i grafana-operator oci://ghcr.io/grafana-operator/helm-charts/grafana-operator --version v5.5.2 -n tester --set namespaceScope=true
Expected behavior
The install should succeed with a generated
Role
that does not contain these cluster-scoped resource types.Suspect component/Location where the bug might be occurring
https://github.com/grafana-operator/grafana-operator/blob/921a4da76410b7d1cc56d31da14a03859dc688fb/deploy/helm/grafana-operator/templates/rbac.yaml#L219-L230
Screenshots
Output of a test installation:
Runtime (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: