mirror of
https://github.com/kyverno/kyverno.git
synced 2025-04-14 00:06:45 +00:00
41 lines
1.3 KiB
YAML
41 lines
1.3 KiB
YAML
|
# 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
|
||
|
- name: check validatingadmissionpolicybinding
|
||
|
try:
|
||
|
- assert:
|
||
|
file: validatingadmissionpolicybinding.yaml
|
||
|
- 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
|