This policy prevents updates to the project field after an Application is created.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: application-prevent-updates-projectannotations:policies.kyverno.io/title: Prevent Updates to Projectpolicies.kyverno.io/category: Argopolicies.kyverno.io/severity: mediumkyverno.io/kyverno-version: 1.6.2policies.kyverno.io/minversion: 1.6.0kyverno.io/kubernetes-version: "1.23"policies.kyverno.io/subject: Applicationpolicies.kyverno.io/description: This policy prevents updates to the project field after an Application is created.spec:validationFailureAction: Auditbackground: truerules:- name: project-updatesmatch:any:- resources:kinds:- Applicationpreconditions:all:- key: "{{ request.operation || 'BACKGROUND' }}"operator: Equalsvalue: UPDATEvalidate:message: The spec.project cannot be changed once the Application is created.deny:conditions:any:- key: "{{request.object.spec.project}}"operator: NotEqualsvalue: "{{request.oldObject.spec.project}}"
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.