apiVersion : kyverno.io/v1
kind : ClusterPolicy
metadata :
  name: check-probe-exists
spec:
  rules:
  - name: check-liveness-probe-exists
    match:
      resources:
        kinds :
        - StatefulSet
    validate:
      message: "a livenessProbe is required"
      pattern:
        spec:
          template:
            spec:
              containers:
              - name: "*"
                livenessProbe:
                  periodSeconds: ">0"
  - name: check-readiness-probe-exists
    match:
      resources:
        kinds :
        - StatefulSet
    validate:
      message: "a readinessProbe is required"
      pattern:
        spec:
          template:
            spec:
              containers:
              - name: "*"
                readinessProbe:
                  periodSeconds: ">0"
