2025-02-27 15:08:35 +02:00
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
apiVersion : chainsaw.kyverno.io/v1alpha1
kind : Test
metadata :
name : with-cel-exception
spec :
steps :
- name : create policy
try :
- create :
file : policy.yaml
- sleep :
duration : 10s
- name : create exception
try :
- create :
file : exception.yaml
- sleep :
duration : 10s
- name : check validatingadmissionpolicy
try :
- assert :
file : validatingadmissionpolicy.yaml
2025-02-28 12:51:36 +02:00
- sleep :
duration : 10s
2025-02-27 15:08:35 +02:00
- name : check validatingadmissionpolicybinding
try :
- assert :
file : validatingadmissionpolicybinding.yaml
2025-02-28 12:51:36 +02:00
- sleep :
duration : 10s
2025-02-27 15:08:35 +02:00
- name : create a skipped deployment
try :
- apply :
file : skipped-deployment.yaml
- name : create a bad deployment
try :
- script :
content : kubectl apply -f bad-deployment.yaml
check :
($error != null) : true
# This check ensures the contents of stderr are exactly as shown.
(trim_space($stderr)) : |-
The deployments "bad-deployment" is invalid: : ValidatingAdmissionPolicy 'vpol-check-deployment-labels' with binding 'vpol-check-deployment-labels-binding' denied request: Deployment labels must be env=prod