@@ -267,10 +267,10 @@ webhooks:
267
267
apiVersions : ["v1"]
268
268
resources : ["rolebindings", "clusterrolebindings"]
269
269
{{- end }}
270
- {{- if eq .Cluster.ConfigItems.teapot_admission_controller_enable_generic_webhook "true" }}
271
- - name : generic- namespaced-admitter.teapot.zalan.do
270
+ {{- if eq .Cluster.ConfigItems.teapot_admission_controller_enable_write_protection_webhook "true" }}
271
+ - name : namespaced-deny -admitter.teapot.zalan.do
272
272
clientConfig :
273
- url : " https://localhost:8085/generic "
273
+ url : " https://localhost:8085/deny "
274
274
caBundle : " {{ .Cluster.ConfigItems.ca_cert_decompressed }}"
275
275
admissionReviewVersions : ["v1beta1"]
276
276
failurePolicy : Fail
@@ -287,9 +287,16 @@ webhooks:
287
287
apiVersions : ["*"]
288
288
resources : ["*/*"]
289
289
scope : " Namespaced"
290
- - name : generic-cluster-admitter.teapot.zalan.do
290
+ matchConditions :
291
+ - name : ' exclude-privileged-groups'
292
+ expression : ' request.userInfo.groups.all(g, !(g in ["system:masters", "system:nodes", "system:serviceaccounts:kube-system", "okta:common/administrator", "zalando:administrator"]))'
293
+ - name : ' exclude-privileged-usernames'
294
+ expression : ' !(request.userInfo.username in ["system:kube-controller-manager", "system:kube-scheduler", "zalando-iam:zalando:service:k8sapi_credentials-provider"])'
295
+ - name : ' exclude-eks-components'
296
+ expression : ' !request.userInfo.username.startsWith("eks:")'
297
+ - name : global-deny-admitter.teapot.zalan.do
291
298
clientConfig :
292
- url : " https://localhost:8085/generic "
299
+ url : " https://localhost:8085/deny "
293
300
caBundle : " {{ .Cluster.ConfigItems.ca_cert_decompressed }}"
294
301
admissionReviewVersions : ["v1beta1"]
295
302
failurePolicy : Fail
@@ -304,4 +311,11 @@ webhooks:
304
311
apiVersions : ["*"]
305
312
resources : ["*/*"]
306
313
scope : " Cluster"
314
+ matchConditions :
315
+ - name : ' exclude-privileged-groups'
316
+ expression : ' request.userInfo.groups.all(g, !(g in ["system:masters", "system:nodes", "system:serviceaccounts:kube-system", "okta:common/administrator", "zalando:administrator"]))'
317
+ - name : ' exclude-privileged-usernames'
318
+ expression : ' !(request.userInfo.username in ["system:kube-controller-manager", "system:kube-scheduler", "zalando-iam:zalando:service:k8sapi_credentials-provider"])'
319
+ - name : ' exclude-eks-components'
320
+ expression : ' !request.userInfo.username.startsWith("eks:")'
307
321
{{- end }}
0 commit comments