Skip to content

Commit ee065df

Browse files
authored
Merge pull request #133409 from carlory/fix-rbac-podcertificaterequestcleaner
Make podcertificaterequestcleaner role feature-gated
2 parents 8ac9a3c + 89b5034 commit ee065df

File tree

3 files changed

+8
-40
lines changed

3 files changed

+8
-40
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,14 @@ func buildControllerRoles() ([]rbacv1.ClusterRole, []rbacv1.ClusterRoleBinding)
430430
eventsRule(),
431431
},
432432
})
433-
addControllerRole(&controllerRoles, &controllerRoleBindings, rbacv1.ClusterRole{
434-
ObjectMeta: metav1.ObjectMeta{Name: saRolePrefix + "podcertificaterequestcleaner"},
435-
Rules: []rbacv1.PolicyRule{
436-
rbacv1helpers.NewRule("get", "list", "watch", "delete").Groups(certificatesGroup).Resources("podcertificaterequests").RuleOrDie(),
437-
},
438-
})
433+
if utilfeature.DefaultFeatureGate.Enabled(features.PodCertificateRequest) {
434+
addControllerRole(&controllerRoles, &controllerRoleBindings, rbacv1.ClusterRole{
435+
ObjectMeta: metav1.ObjectMeta{Name: saRolePrefix + "podcertificaterequestcleaner"},
436+
Rules: []rbacv1.PolicyRule{
437+
rbacv1helpers.NewRule("get", "list", "watch", "delete").Groups(certificatesGroup).Resources("podcertificaterequests").RuleOrDie(),
438+
},
439+
})
440+
}
439441
addControllerRole(&controllerRoles, &controllerRoleBindings, rbacv1.ClusterRole{
440442
ObjectMeta: metav1.ObjectMeta{Name: saRolePrefix + "pvc-protection-controller"},
441443
Rules: []rbacv1.PolicyRule{

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -320,22 +320,6 @@ items:
320320
- kind: ServiceAccount
321321
name: pod-garbage-collector
322322
namespace: kube-system
323-
- apiVersion: rbac.authorization.k8s.io/v1
324-
kind: ClusterRoleBinding
325-
metadata:
326-
annotations:
327-
rbac.authorization.kubernetes.io/autoupdate: "true"
328-
labels:
329-
kubernetes.io/bootstrapping: rbac-defaults
330-
name: system:controller:podcertificaterequestcleaner
331-
roleRef:
332-
apiGroup: rbac.authorization.k8s.io
333-
kind: ClusterRole
334-
name: system:controller:podcertificaterequestcleaner
335-
subjects:
336-
- kind: ServiceAccount
337-
name: podcertificaterequestcleaner
338-
namespace: kube-system
339323
- apiVersion: rbac.authorization.k8s.io/v1
340324
kind: ClusterRoleBinding
341325
metadata:

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

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,24 +1037,6 @@ items:
10371037
- pods/status
10381038
verbs:
10391039
- patch
1040-
- apiVersion: rbac.authorization.k8s.io/v1
1041-
kind: ClusterRole
1042-
metadata:
1043-
annotations:
1044-
rbac.authorization.kubernetes.io/autoupdate: "true"
1045-
labels:
1046-
kubernetes.io/bootstrapping: rbac-defaults
1047-
name: system:controller:podcertificaterequestcleaner
1048-
rules:
1049-
- apiGroups:
1050-
- certificates.k8s.io
1051-
resources:
1052-
- podcertificaterequests
1053-
verbs:
1054-
- delete
1055-
- get
1056-
- list
1057-
- watch
10581040
- apiVersion: rbac.authorization.k8s.io/v1
10591041
kind: ClusterRole
10601042
metadata:

0 commit comments

Comments
 (0)