1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-09 17:37:12 +00:00
kyverno/test/conformance/chainsaw/policy-validation/cluster-policy/invalid-pod-security-rule/chainsaw-test.yaml
Charles-Edouard Brétéché 5a0ce6bb67
chore: bump chainsaw (#11161)
* chore: bump chainsaw

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* more template use

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* v0.2.10

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* go mod

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2024-09-17 09:28:33 +00:00

24 lines
1.1 KiB
YAML
Executable file

apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: invalid-pod-security-rule
spec:
steps:
- name: Apply the first policy
try:
- script:
content: kubectl apply -f policy-1.yaml
check:
($error != null): true
# This check ensures the contents of stderr are exactly as shown.
(trim_space($stderr)): |-
Error from server: error when creating "policy-1.yaml": admission webhook "validate-policy.kyverno.svc" denied the request: spec.rules[0].podSecurity.exclude[0].values: Forbidden: values is required
- name: Apply the second policy
try:
- script:
content: kubectl apply -f policy-2.yaml
check:
($error != null): true
# This check ensures the contents of stderr are exactly as shown.
(trim_space($stderr)): |-
Error from server: error when creating "policy-2.yaml": admission webhook "validate-policy.kyverno.svc" denied the request: spec.rules[0].podSecurity.exclude[0].restrictedField: Forbidden: restrictedField is required