Skip to content

Commit fc24307

Browse files
authored
fix: RBAC role for namespace-sync controller to watch,list namespaces (#738)
**What problem does this PR solve?**: Noticed an error in the logs: ``` E0620 21:23:28.879891 1 reflector.go:147] k8s.io/[email protected]/tools/cache/reflector.go:229: Failed to watch *v1.Namespace: failed to list *v1.Namespace: namespaces is forbidden: User "system:serviceaccount:default:cluster-api-runtime-extensions-nutanix" cannot list resource "namespaces" in API group "" at the cluster scope ``` **Which issue(s) this PR fixes**: Fixes # **How Has This Been Tested?**: <!-- Please describe the tests that you ran to verify your changes. Provide output from the tests and any manual steps needed to replicate the tests. --> **Special notes for your reviewer**: <!-- Use this to provide any additional information to the reviewers. This may include: - Best way to review the PR. - Where the author wants the most review attention on. - etc. -->
1 parent b6ed5e9 commit fc24307

File tree

2 files changed

+9
-0
lines changed
  • charts/cluster-api-runtime-extensions-nutanix/templates
  • pkg/controllers/namespacesync

2 files changed

+9
-0
lines changed

charts/cluster-api-runtime-extensions-nutanix/templates/role.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ rules:
1818
- patch
1919
- update
2020
- watch
21+
- apiGroups:
22+
- ""
23+
resources:
24+
- namespaces
25+
verbs:
26+
- get
27+
- list
28+
- watch
2129
- apiGroups:
2230
- ""
2331
resources:

pkg/controllers/namespacesync/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
//
1313
// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io;bootstrap.cluster.x-k8s.io;controlplane.cluster.x-k8s.io,resources=*,verbs=get;list;watch;create
1414
// +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=clusterclasses,verbs=get;list;watch;create
15+
// +kubebuilder:rbac:groups="",resources=namespaces,verbs=get;list;watch
1516
package namespacesync

0 commit comments

Comments
 (0)