Skip to content

Commit 1cf2fd1

Browse files
committed
Fix permissions for endpointslice controller
The controller needs to be able to set a service's finalizers to be able to create an EndpointSlice resource that is owned by the service and sets blockOwnerDeletion=true in its ownerRef.
1 parent ff809a5 commit 1cf2fd1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ func buildControllerRoles() ([]rbacv1.ClusterRole, []rbacv1.ClusterRoleBinding)
153153
ObjectMeta: metav1.ObjectMeta{Name: saRolePrefix + "endpointslice-controller"},
154154
Rules: []rbacv1.PolicyRule{
155155
rbacv1helpers.NewRule("get", "list", "watch").Groups(legacyGroup).Resources("services", "pods", "nodes").RuleOrDie(),
156+
// The controller needs to be able to set a service's finalizers to be able to create an EndpointSlice
157+
// resource that is owned by the service and sets blockOwnerDeletion=true in its ownerRef.
158+
rbacv1helpers.NewRule("update").Groups(legacyGroup).Resources("services/finalizers").RuleOrDie(),
156159
rbacv1helpers.NewRule("get", "list", "create", "update", "delete").Groups(discoveryGroup).Resources("endpointslices").RuleOrDie(),
157160
eventsRule(),
158161
},

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,12 @@ items:
494494
- get
495495
- list
496496
- watch
497+
- apiGroups:
498+
- ""
499+
resources:
500+
- services/finalizers
501+
verbs:
502+
- update
497503
- apiGroups:
498504
- discovery.k8s.io
499505
resources:

0 commit comments

Comments
 (0)