Node taints are often used as a control in multi-tenant use cases. If users can alter them, they may be able to affect scheduling of Pods which may impact other workloads. This sample prohibits altering of node taints unless by a user holding the `cluster-admin` ClusterRole. Use of this policy requires removal of the Node resource filter in the Kyverno ConfigMap ([Node,*,*]). Due to Kubernetes CVE-2021-25735, this policy requires, at minimum, one of the following versions of Kubernetes: v1.18.18, v1.19.10, v1.20.6, or v1.21.0.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: protect-node-taintsannotations:policies.kyverno.io/title: Protect Node Taintspolicies.kyverno.io/category: Otherpolicies.kyverno.io/subject: Nodepolicies.kyverno.io/minversion: 1.6.0policies.kyverno.io/description: "Node taints are often used as a control in multi-tenant use cases. If users can alter them, they may be able to affect scheduling of Pods which may impact other workloads. This sample prohibits altering of node taints unless by a user holding the `cluster-admin` ClusterRole. Use of this policy requires removal of the Node resource filter in the Kyverno ConfigMap ([Node,*,*]). Due to Kubernetes CVE-2021-25735, this policy requires, at minimum, one of the following versions of Kubernetes: v1.18.18, v1.19.10, v1.20.6, or v1.21.0."spec:validationFailureAction: Enforcebackground: falserules:- name: protect-node-taintsmatch:any:- resources:kinds:- Nodeexclude:clusterRoles:- cluster-adminpreconditions:all:- key: "{{request.operation || 'BACKGROUND'}}"operator: Equalsvalue: UPDATEvalidate:message: Node taints may not be altered.deny:conditions:any:- key: "{{request.object.spec.taints}}"operator: NotEqualsvalue: ""- key: "{{request.oldObject.spec.taints}}"operator: NotEqualsvalue: "{{request.object.spec.taints}}"
This policy prevents the use of the default project in an Application.
This policy prevents updates to the project field after an Application is created.
This policy ensures that the name of the ApplicationSet is the same value provided in the project.