Skip to content

Commit 03735b8

Browse files
committed
make sync and doc generate
1 parent 88f6b48 commit 03735b8

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

build/selectorsyncset.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,36 @@ objects:
274274
scope: Cluster
275275
sideEffects: None
276276
timeoutSeconds: 2
277+
- apiVersion: admissionregistration.k8s.io/v1
278+
kind: ValidatingWebhookConfiguration
279+
metadata:
280+
annotations:
281+
service.beta.openshift.io/inject-cabundle: "true"
282+
creationTimestamp: null
283+
name: sre-clusterroles-validation
284+
webhooks:
285+
- admissionReviewVersions:
286+
- v1
287+
clientConfig:
288+
service:
289+
name: validation-webhook
290+
namespace: openshift-validation-webhook
291+
path: /clusterroles-validation
292+
failurePolicy: Ignore
293+
matchPolicy: Equivalent
294+
name: clusterroles-validation.managed.openshift.io
295+
rules:
296+
- apiGroups:
297+
- rbac.authorization.k8s.io
298+
apiVersions:
299+
- v1
300+
operations:
301+
- DELETE
302+
resources:
303+
- clusterroles
304+
scope: Cluster
305+
sideEffects: None
306+
timeoutSeconds: 2
277307
- apiVersion: admissionregistration.k8s.io/v1
278308
kind: ValidatingWebhookConfiguration
279309
metadata:

pkg/webhooks/clusterrole/clusterrole.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ import (
1919
)
2020

2121
const (
22-
WebhookName string = "clusterroles-validation"
23-
docString string = `Managed OpenShift Customers may not delete protected ClusterRoles including cluster-admin, view, edit, admin, specific system roles (system:admin, system:node, system:node-proxier, system:kube-scheduler, system:kube-controller-manager), and backplane-* roles`
22+
WebhookName string = "clusterroles-validation"
23+
backplanePrefix string = "backplane-"
24+
docString string = `Managed OpenShift Customers may not delete protected ClusterRoles including cluster-admin, view, edit, admin, specific system roles (system:admin, system:node, system:node-proxier, system:kube-scheduler, system:kube-controller-manager), and backplane-* roles`
2425
)
2526

2627
var (
@@ -47,7 +48,6 @@ var (
4748
"admin",
4849
"system:admin",
4950
"system:node",
50-
"system:node-proxier",
5151
"system:kube-scheduler",
5252
"system:kube-controller-manager",
5353
}
@@ -172,12 +172,10 @@ func isProtectedClusterRole(clusterRole *rbacv1.ClusterRole) bool {
172172
if slices.Contains(protectedClusterRoles, clusterRole.Name) {
173173
return true
174174
}
175-
176175
// Check if it matches backplane pattern
177-
if strings.HasPrefix(clusterRole.Name, "backplane-") {
176+
if strings.HasPrefix(clusterRole.Name, backplanePrefix) {
178177
return true
179178
}
180-
181179
return false
182180
}
183181

0 commit comments

Comments
 (0)