Skip to content

Add some missing permissions to the calico-kube-controller - #18

Open
james-callahan wants to merge 3 commits into
mainfrom
missing-perms
Open

Add some missing permissions to the calico-kube-controller#18
james-callahan wants to merge 3 commits into
mainfrom
missing-perms

Conversation

@james-callahan

Copy link
Copy Markdown
Collaborator

This fixes the errors mentioned in #17

Without this permission, the controller logs errors of:
```
2026-09-02 04:38:30.872 [ERROR][14] kube-controllers/policy_name_migrator.go 239: Error getting calico-node DaemonSet: daemonsets.apps "calico-node" is forbidden: User "system:serviceaccount:calico:calico-kube-controllers" cannot get resource "daemonsets" in API group "apps" in the namespace "calico"
```

Upstream grants this more broadly: as a ClusterRole across all daemonsets, and
grants write access; but we want to be more precise
Without this the controller logs errors:
```
2026-09-02 04:44:42.131 [INFO][14] kube-controllers/watchercache.go 243: Full resync is required ListRoot=".../v3/pc.org/stagednetworkpolicies"
2026-09-02 04:44:42.131 [INFO][14] kube-controllers/watchercache.go 243: Full resync is required ListRoot=".../v3/pc.org/globalnetworkpolicies"
2026-09-02 04:44:42.132 [INFO][14] kube-controllers/watchercache.go 243: Full resync is required ListRoot=".../v3/pc.org/stagedglobalnetworkpolicies"
2026-09-02 04:44:42.132 [INFO][14] kube-controllers/watchercache.go 243: Full resync is required ListRoot=".../v3/pc.org/networkpolicies"
2026-09-02 04:44:42.133 [INFO][14] kube-controllers/watchercache.go 274: Failed to perform list of current data during resync ListRoot=".../v3/pc.org/globalnetworkpolicies" error=connection is unauthorized: globalnetworkpolicies.crd.projectcalico.org is forbidden: User "system:serviceaccount:calico:calico-kube-controllers" cannot list resource "globalnetworkpolicies" in API group "crd.projectcalico.org" at the cluster scope
2026-09-02 04:44:42.133 [WARNING][14] kube-controllers/watchercache.go 284: Connection to datastore has failed - signaling error to client. ListRoot=".../v3/pc.org/globalnetworkpolicies"
2026-09-02 04:44:42.133 [INFO][14] kube-controllers/watchercache.go 274: Failed to perform list of current data during resync ListRoot=".../v3/pc.org/stagednetworkpolicies" error=connection is unauthorized: stagednetworkpolicies.crd.projectcalico.org is forbidden: User "system:serviceaccount:calico:calico-kube-controllers" cannot list resource "stagednetworkpolicies" in API group "crd.projectcalico.org" at the cluster scope
2026-09-02 04:44:42.133 [WARNING][14] kube-controllers/watchercache.go 284: Connection to datastore has failed - signaling error to client. ListRoot=".../v3/pc.org/stagednetworkpolicies"
2026-09-02 04:44:42.133 [INFO][14] kube-controllers/watchercache.go 274: Failed to perform list of current data during resync ListRoot=".../v3/pc.org/stagedglobalnetworkpolicies" error=connection is unauthorized: stagedglobalnetworkpolicies.crd.projectcalico.org is forbidden: User "system:serviceaccount:calico:calico-kube-controllers" cannot list resource "stagedglobalnetworkpolicies" in API group "crd.projectcalico.org" at the cluster scope
2026-09-02 04:44:42.133 [WARNING][14] kube-controllers/watchercache.go 284: Connection to datastore has failed - signaling error to client. ListRoot=".../v3/pc.org/stagedglobalnetworkpolicies"
2026-09-02 04:44:42.133 [INFO][14] kube-controllers/watchercache.go 274: Failed to perform list of current data during resync ListRoot=".../v3/pc.org/networkpolicies" error=connection is unauthorized: networkpolicies.crd.projectcalico.org is forbidden: User "system:serviceaccount:calico:calico-kube-controllers" cannot list resource "networkpolicies" in API group "crd.projectcalico.org" at the cluster scope
2026-09-02 04:44:42.133 [WARNING][14] kube-controllers/watchercache.go 284: Connection to datastore has failed - signaling error to client. ListRoot=".../v3/pc.org/networkpolicies"
```

Upstream also grants create, update, delete; but we choose not to here for now
Without this the controller logs errors:
```
E0902 04:48:36.337079      14 reflector.go:204] "Failed to watch" err="failed to list *v1.CustomResourceDefinition: customresourcedefinitions.apiextensions.k8s.io is forbidden: User \"system:serviceaccount:calico:calico-kube-controllers\" cannot list resource \"customresourcedefinitions\" in API group \"apiextensions.k8s.io\" at the cluster scope" logger="UnhandledError" reflector="pkg/mod/k8s.io/client-go@v0.35.8/tools/cache/reflector.go:289" type="*v1.CustomResourceDefinition"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant