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: policies.kyverno.io/v1
kind: ValidatingPolicy
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.17.0
policies.kyverno.io/minversion: 1.17.0
kyverno.io/kubernetes-version: 1.34-1.35
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:
validationActions:
- Audit
evaluation:
background:
enabled: true
matchConstraints:
resourceRules:
- apiGroups:
- argoproj.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- applicationsets
validations:
- message: The name must match the project.
expression: object.spec.template.spec.project == object.metadata.name

Related Policies