mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-10 18:06:55 +00:00
26 lines
953 B
YAML
Executable file
26 lines
953 B
YAML
Executable file
apiVersion: chainsaw.kyverno.io/v1alpha1
|
|
kind: Test
|
|
metadata:
|
|
creationTimestamp: null
|
|
name: adding-key-to-config-map
|
|
spec:
|
|
steps:
|
|
- name: step-01
|
|
try:
|
|
- apply:
|
|
file: chainsaw-step-01-apply-1-1.yaml
|
|
- apply:
|
|
file: chainsaw-step-01-apply-1-2.yaml
|
|
- apply:
|
|
file: chainsaw-step-01-apply-1-3.yaml
|
|
- assert:
|
|
file: chainsaw-step-01-assert-1-1.yaml
|
|
- name: step-02
|
|
try:
|
|
- script:
|
|
content: "if kubectl patch ConfigMap test-configmap -n test-validate-e2e-adding-key-to-config-map
|
|
--type='json' -p=\"[{\\\"op\\\": \\\"add\\\", \\\"path\\\": \\\"/data/lock\\\",
|
|
\\\"value\\\":\"\"admin\"\"}]\" 2>&1 | grep -q 'validation error: Configmap
|
|
key must be \"abc\"' \nthen \n echo \"Test succeeded. Resource was blocked
|
|
from adding key.\"\n exit 0\nelse \n echo \"Tested failed. Resource was
|
|
not blocked from adding key.\"\n exit 1 \nfi\n"
|