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/globalcontext/validate-reference/clusterpolicy.yaml
Mariam Fahmy 2140a0239b
chore: rename validationFailureAction to failureAction under the rule (#10893)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2024-08-27 20:07:57 +00:00

32 lines
661 B
YAML
Executable file

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: cpol-gctx-validate-reference
spec:
failurePolicy: Fail
rules:
- name: main-deployment-exists
context:
- name: deploymentCount
globalReference:
jmesPath: "items | length(@)"
match:
all:
- resources:
kinds:
- Pod
preconditions:
all:
- key: '{{ request.operation }}'
operator: AnyIn
value:
- CREATE
- UPDATE
validate:
failureAction: Enforce
deny:
conditions:
any:
- key: "{{ deploymentCount }}"
operator: Equal
value: 0