2024-02-06 19:03:32 +02:00
|
|
|
apiVersion: chainsaw.kyverno.io/v1alpha1
|
|
|
|
kind: Test
|
|
|
|
metadata:
|
2024-02-08 09:46:58 +02:00
|
|
|
name: gctxentry-not-exist
|
2024-02-06 19:03:32 +02:00
|
|
|
spec:
|
|
|
|
steps:
|
2025-02-18 17:51:14 +02:00
|
|
|
- name: setup
|
|
|
|
try:
|
|
|
|
- apply:
|
|
|
|
file: namespace.yaml
|
|
|
|
- apply:
|
|
|
|
file: main-deployment.yaml
|
|
|
|
- name: create policy
|
|
|
|
use:
|
|
|
|
template: ../../_step-templates/create-policy.yaml
|
|
|
|
with:
|
|
|
|
bindings:
|
|
|
|
- name: file
|
|
|
|
value: clusterpolicy.yaml
|
|
|
|
- name: wait policy ready
|
|
|
|
use:
|
|
|
|
template: ../../_step-templates/cluster-policy-ready.yaml
|
|
|
|
with:
|
|
|
|
bindings:
|
|
|
|
- name: name
|
|
|
|
value: cpol-gctxentry-not-exist
|
|
|
|
- name: create new deployment
|
|
|
|
try:
|
|
|
|
- script:
|
|
|
|
content: kubectl apply -f new-deployment.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 "new-deployment.yaml": admission webhook "validate.kyverno.svc-fail" denied the request:
|
|
|
|
|
|
|
|
resource Deployment/test-globalcontext-gctxentry-not-exist/new-deployment was blocked due to the following policies
|
|
|
|
|
|
|
|
cpol-gctxentry-not-exist:
|
|
|
|
autogen-main-deployment-exists: 'failed to check deny conditions: failed to substitute
|
|
|
|
variables in condition key: failed to resolve deploymentCount at path : failed
|
|
|
|
to marshal APICall data for context entry deploymentCount: failed to fetch entry
|
|
|
|
key=non-existent-gctx'
|