1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-10 01:46:55 +00:00
kyverno/test/conformance/chainsaw/exceptions/good-bad-conditions/policy.yaml
Khaled Emara 21602a1e1f
fix(polex): multiple polexes with conditions (#9994)
Signed-off-by: Khaled Emara <khaled.emara@nirmata.com>
Co-authored-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2024-05-06 10:28:39 +00:00

22 lines
507 B
YAML

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: max-containers
spec:
validationFailureAction: Enforce
background: false
rules:
- name: max-two-containers
match:
any:
- resources:
kinds:
- Pod
validate:
message: "A maximum of 2 containers are allowed inside a Pod."
deny:
conditions:
any:
- key: "{{request.object.spec.containers[] | length(@)}}"
operator: GreaterThan
value: "2"