Created
May 8, 2023 09:23
-
-
Save tommeramber/ed6647797ec1b487ad098174a0405656 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: kyverno.io/v1 | |
kind: ClusterPolicy | |
metadata: | |
name: block-cluster-admin-openshift-etcd-ns | |
annotations: | |
policies.kyverno.io/title: Block Cluster Admin on Openshift-etcd Namespace | |
policies.kyverno.io/category: Sample | |
policies.kyverno.io/subject: RBAC | |
spec: | |
validationFailureAction: enforce | |
background: false | |
rules: | |
- name: block-cluster-admin-openshift-etcd-ns | |
match: | |
any: | |
- resources: | |
kinds: | |
- "*" | |
namespaces: | |
- openshift-etcd | |
clusterRoles: | |
- cluster-admin | |
subjects: | |
- kind: User | |
name: test | |
validate: | |
message: "The cluster-admin 'test' user cannot touch Openshift-etcd Namespace." | |
deny: | |
conditions: | |
any: | |
- key: "{{request.operation || 'BACKGROUND'}}" | |
operator: AnyIn | |
value: | |
- CREATE | |
- UPDATE | |
- DELETE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment