Skip to content

Commit f2da04b

Browse files
fix: scope operator's CRD permissions to cilium endpoints/identities (#800)
# Description Use minimal required RBAC. Retina Operator only needs to manage CiliumEndpoints and CiliumIdentities. Note: `create` cannot be scoped to resourceNames per the k8s documentation: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources Trying to scope `create` resulted in CrashLoop for Retina operator with the error: ``` unable to create CRDs: Unable to create custom resource definition: customresourcedefinitions.apiextensions.k8s.io is forbidden: User \"system:serviceaccount:kube-system:retina-operator\" cannot create resource \"customresourcedefinitions\" in API group \"apiextensions.k8s.io\" at the cluster scope" function="github.com/Azure/retina-enterprise/operator/k8s/apis.createCRDs.func1 (workspace/operator/k8s/apis/cell.go:61) ``` ## Checklist - [x] I have read the [contributing documentation](https://retina.sh/docs/contributing). - [x] I signed and signed-off the commits (`git commit -S -s ...`). See [this documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) on signing commits. - [x] I have correctly attributed the author(s) of the code. - [x] I have tested the changes locally. - [x] I have followed the project's style guidelines. - [ ] I have updated the documentation, if necessary. - [ ] I have added tests, if applicable. ## Tests CRDs were created. Retina Operator had no errors on first install or after being manually restarted. Signed-off-by: Hunter Gregory <[email protected]>
1 parent 3b8bff8 commit f2da04b

File tree

1 file changed

+11
-3
lines changed
  • deploy/hubble/manifests/controller/helm/retina/templates/operator

1 file changed

+11
-3
lines changed

deploy/hubble/manifests/controller/helm/retina/templates/operator/clusterrole.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@ metadata:
55
creationTimestamp: null
66
name: retina-operator-role
77
rules:
8-
- apiGroups:
8+
- apiGroups:
99
- "apiextensions.k8s.io"
10-
resources:
10+
resources:
1111
- "customresourcedefinitions"
12-
verbs:
12+
verbs:
1313
- "create"
14+
- apiGroups:
15+
- "apiextensions.k8s.io"
16+
resources:
17+
- "customresourcedefinitions"
18+
resourceNames:
19+
- ciliumidentities.cilium.io
20+
- ciliumendpoints.cilium.io
21+
verbs:
1422
- "get"
1523
- "update"
1624
- "delete"

0 commit comments

Comments
 (0)