Back to Policies

Ensure ApplicationSet Name Matches Project in CEL expressions

This policy ensures that the name of the ApplicationSet is the same value provided in the project.

View on GitHub

Policy Definition

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: applicationset-name-matches-project
annotations:
policies.kyverno.io/title: Ensure ApplicationSet Name Matches Project in CEL expressions
policies.kyverno.io/category: Argo in CEL
policies.kyverno.io/severity: medium
kyverno.io/kyverno-version: 1.11.0
policies.kyverno.io/minversion: 1.11.0
kyverno.io/kubernetes-version: 1.26-1.27
policies.kyverno.io/subject: ApplicationSet
policies.kyverno.io/description: This policy ensures that the name of the ApplicationSet is the same value provided in the project.
spec:
validationFailureAction: Audit
background: true
rules:
- name: match-name
match:
any:
- resources:
kinds:
- ApplicationSet
operations:
- CREATE
- UPDATE
validate:
cel:
expressions:
- expression: object.spec.template.spec.project == object.metadata.name
message: The name must match the project.

Related Policies