2023-12-06 22:39:17 +01:00
|
|
|
apiVersion: chainsaw.kyverno.io/v1alpha1
|
|
|
|
kind: Test
|
|
|
|
metadata:
|
|
|
|
name: with-wildcard
|
|
|
|
spec:
|
|
|
|
steps:
|
2024-10-03 13:56:30 +02:00
|
|
|
- name: create policy
|
|
|
|
use:
|
|
|
|
template: ../../_step-templates/create-policy.yaml
|
|
|
|
with:
|
|
|
|
bindings:
|
|
|
|
- name: file
|
|
|
|
value: policy.yaml
|
|
|
|
- name: wait policy ready
|
|
|
|
use:
|
|
|
|
template: ../../_step-templates/cluster-policy-ready.yaml
|
|
|
|
with:
|
|
|
|
bindings:
|
|
|
|
- name: name
|
|
|
|
value: require-labels
|
2023-12-06 22:39:17 +01:00
|
|
|
- name: step-02
|
|
|
|
try:
|
|
|
|
- apply:
|
|
|
|
file: exception.yaml
|
|
|
|
- name: step-03
|
|
|
|
try:
|
|
|
|
- apply:
|
|
|
|
file: configmap-allowed.yaml
|
|
|
|
- apply:
|
|
|
|
expect:
|
|
|
|
- check:
|
|
|
|
($error != null): true
|
|
|
|
file: configmap-rejected.yaml
|
|
|
|
- assert:
|
|
|
|
file: configmap-allowed.yaml
|
|
|
|
- error:
|
|
|
|
file: configmap-rejected.yaml
|