Skip to content

Commit 27e32c4

Browse files
authored
Add missing permission for NSS operator (#287)
Signed-off-by: Daniel Fan <[email protected]>
1 parent ae94063 commit 27e32c4

File tree

3 files changed

+77
-15
lines changed

3 files changed

+77
-15
lines changed

bundle/manifests/ibm-namespace-scope-operator.clusterserviceversion.yaml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ metadata:
2323
]
2424
capabilities: Seamless Upgrades
2525
containerImage: icr.io/cpopen/ibm-namespace-scope-operator:latest
26-
createdAt: "2020-11-2T15:38:33Z"
26+
createdAt: "2023-11-02T00:44:43Z"
2727
olm.skipRange: '<4.2.1'
2828
operators.openshift.io/infrastructure-features: '["disconnected"]'
2929
operators.operatorframework.io/builder: operator-sdk-v1.32.0
@@ -69,6 +69,13 @@ spec:
6969
- patch
7070
- update
7171
- watch
72+
- apiGroups:
73+
- ""
74+
resources:
75+
- namespaces
76+
verbs:
77+
- get
78+
- list
7279
serviceAccountName: ibm-namespace-scope-operator
7380
deployments:
7481
- label:
@@ -154,6 +161,7 @@ spec:
154161
- patch
155162
- update
156163
- watch
164+
- deletecollection
157165
- apiGroups:
158166
- ""
159167
resources:
@@ -182,12 +190,35 @@ spec:
182190
resources:
183191
- namespacescopes
184192
- namespacescopes/status
193+
- namespacescopes/finalizers
194+
verbs:
195+
- get
196+
- list
197+
- patch
198+
- update
199+
- watch
200+
- apiGroups:
201+
- apps
202+
resources:
203+
- deployments
204+
- daemonsets
205+
- statefulsets
185206
verbs:
207+
- delete
186208
- get
187209
- list
188210
- patch
189211
- update
190212
- watch
213+
- deletecollection
214+
- create
215+
- apiGroups:
216+
- ""
217+
resources:
218+
- serviceaccounts
219+
verbs:
220+
- get
221+
- list
191222
serviceAccountName: ibm-namespace-scope-operator
192223
strategy: deployment
193224
installModes:

config/rbac/role.yaml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ rules:
1111
- patch
1212
- update
1313
- watch
14+
- deletecollection
1415
apiGroups:
1516
- rbac.authorization.k8s.io
1617
resources:
@@ -50,23 +51,53 @@ rules:
5051
resources:
5152
- namespacescopes
5253
- namespacescopes/status
54+
- namespacescopes/finalizers
55+
- verbs:
56+
- delete
57+
- get
58+
- list
59+
- patch
60+
- update
61+
- watch
62+
- deletecollection
63+
- create
64+
apiGroups:
65+
- apps
66+
resources:
67+
- deployments
68+
- daemonsets
69+
- statefulsets
70+
- verbs:
71+
- get
72+
- list
73+
apiGroups:
74+
- ''
75+
resources:
76+
- serviceaccounts
5377
---
5478
apiVersion: rbac.authorization.k8s.io/v1
5579
kind: ClusterRole
5680
metadata:
5781
name: ibm-namespace-scope-operator
5882
rules:
5983
# manage mutation webhook configuration
60-
- apiGroups:
61-
- admissionregistration.k8s.io
62-
resources:
63-
- mutatingwebhookconfigurations
64-
- validatingwebhookconfigurations
65-
verbs:
66-
- create
67-
- delete
68-
- get
69-
- list
70-
- patch
71-
- update
72-
- watch
84+
- verbs:
85+
- create
86+
- delete
87+
- get
88+
- list
89+
- patch
90+
- update
91+
- watch
92+
apiGroups:
93+
- admissionregistration.k8s.io
94+
resources:
95+
- mutatingwebhookconfigurations
96+
- validatingwebhookconfigurations
97+
- verbs:
98+
- get
99+
- list
100+
apiGroups:
101+
- ''
102+
resources:
103+
- namespaces

controllers/namespacescope_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ func (r *NamespaceScopeReconciler) getValidatedNamespaces(ctx context.Context, i
949949
if r.checkGetNSAuth(ctx) {
950950
ns := &corev1.Namespace{}
951951
key := types.NamespacedName{Name: nsMem}
952-
if err := r.Client.Get(ctx, key, ns); err != nil {
952+
if err := r.Reader.Get(ctx, key, ns); err != nil {
953953
if errors.IsNotFound(err) {
954954
klog.Infof("Namespace %s does not exist and will be ignored", nsMem)
955955
continue

0 commit comments

Comments
 (0)