Skip to content

Commit 3571992

Browse files
committed
Add watch permission to namespace-controller for WatchListClient feature
The WatchListClient feature is enabled for kube-controller-manager, but namespace-controller misses the necessary "watch" permission, which results in 30 error logs being generated every time a namespace is deleted and falling back to the standard LIST semantics. Signed-off-by: Quan Tian <[email protected]>
1 parent e7b40fd commit 3571992

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

plugin/pkg/auth/authorizer/rbac/bootstrappolicy/controller_policy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func buildControllerRoles() ([]rbacv1.ClusterRole, []rbacv1.ClusterRoleBinding)
254254
Rules: []rbacv1.PolicyRule{
255255
rbacv1helpers.NewRule("get", "list", "watch", "delete").Groups(legacyGroup).Resources("namespaces").RuleOrDie(),
256256
rbacv1helpers.NewRule("update").Groups(legacyGroup).Resources("namespaces/finalize", "namespaces/status").RuleOrDie(),
257-
rbacv1helpers.NewRule("get", "list", "delete", "deletecollection").Groups("*").Resources("*").RuleOrDie(),
257+
rbacv1helpers.NewRule("get", "list", "watch", "delete", "deletecollection").Groups("*").Resources("*").RuleOrDie(),
258258
},
259259
})
260260
addControllerRole(&controllerRoles, &controllerRoleBindings, func() rbacv1.ClusterRole {

plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,7 @@ items:
875875
- deletecollection
876876
- get
877877
- list
878+
- watch
878879
- apiVersion: rbac.authorization.k8s.io/v1
879880
kind: ClusterRole
880881
metadata:

0 commit comments

Comments
 (0)