1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/test/more/ensure_probes_different.yaml
Charles-Edouard Brétéché 7562bea6db
chore: apply policy fixes (#8427)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-17 22:24:26 +00:00

64 lines
1.8 KiB
YAML

---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
annotations:
pod-policies.kyverno.io/autogen-controllers: DaemonSet,Deployment,StatefulSet
name: validate-probes
spec:
admission: true
background: false
rules:
- match:
any:
- resources:
kinds:
- Pod
name: validate-probes-c0
validate:
deny:
conditions:
- key: '{{ request.object.spec.containers[0].readinessProbe }}'
operator: Equals
value: '{{ request.object.spec.containers[0].livenessProbe }}'
message: Liveness and readiness probes cannot be the same.
- match:
any:
- resources:
kinds:
- Pod
name: validate-probes-c1
validate:
deny:
conditions:
- key: '{{ request.object.spec.containers[1].readinessProbe }}'
operator: Equals
value: '{{ request.object.spec.containers[1].livenessProbe }}'
message: Liveness and readiness probes cannot be the same.
- match:
any:
- resources:
kinds:
- Pod
name: validate-probes-c2
validate:
deny:
conditions:
- key: '{{ request.object.spec.containers[2].readinessProbe }}'
operator: Equals
value: '{{ request.object.spec.containers[2].livenessProbe }}'
message: Liveness and readiness probes cannot be the same.
- match:
any:
- resources:
kinds:
- Pod
name: validate-probes-c3
validate:
deny:
conditions:
- key: '{{ request.object.spec.containers[3].readinessProbe }}'
operator: Equals
value: '{{ request.object.spec.containers[3].livenessProbe }}'
message: Liveness and readiness probes cannot be the same.
validationFailureAction: Enforce