apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: require-resource-labels
  annotations:
    policies.kyverno.io/title: Require ACDL Resource Labels
    policies.kyverno.io/category: Governance
    policies.kyverno.io/severity: medium
    policies.kyverno.io/subject: Pod
spec:
  validationFailureAction: audit
  background: true
  rules:
    - name: require-acdl-owner-label
      match:
        any:
          - resources:
              kinds:
                - Pod
      validate:
        message: "Pods must carry the acdl:owner label (ACDL tagging standard)."
        pattern:
          metadata:
            labels:
              acdl:owner: "?*"
    - name: require-acdl-environment-label
      match:
        any:
          - resources:
              kinds:
                - Pod
      validate:
        message: "Pods must carry the acdl:environment label (ACDL tagging standard)."
        pattern:
          metadata:
            labels:
              acdl:environment: "?*"