apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: require-resource-labels
  annotations:
    policies.kyverno.io/title: Require Nova 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-nova-owner-label
      match:
        any:
          - resources:
              kinds:
                - Pod
      validate:
        message: "Pods must carry the nova:owner label (Nova tagging standard)."
        pattern:
          metadata:
            labels:
              nova:owner: "?*"
    - name: require-nova-environment-label
      match:
        any:
          - resources:
              kinds:
                - Pod
      validate:
        message: "Pods must carry the nova:environment label (Nova tagging standard)."
        pattern:
          metadata:
            labels:
              nova:environment: "?*"