This policy ensures that the name of the ApplicationSet is the same value provided in the project.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: applicationset-name-matches-projectannotations:policies.kyverno.io/title: Ensure ApplicationSet Name Matches 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: ApplicationSetpolicies.kyverno.io/description: This policy ensures that the name of the ApplicationSet is the same value provided in the project.spec:validationFailureAction: Auditbackground: truerules:- name: match-namematch:any:- resources:kinds:- ApplicationSetpreconditions:all:- key: "{{ request.operation || 'BACKGROUND' }}"operator: NotEqualsvalue: DELETEvalidate:message: The name must match the project.pattern:spec:template:spec:project: "{{request.object.metadata.name}}"
This policy prevents the use of the default project in an Application.
This policy ensures that the name of the ApplicationSet is the same value provided in the project.
This policy prevents the use of the default project in an Application.