apiVersion: templates.gatekeeper.sh/v1 kind: ConstraintTemplate metadata: name: k8srequiredannotations annotations: metadata.gatekeeper.sh/title: "Required Annotations" metadata.gatekeeper.sh/version: 1.0.1 description: >- Requires resources to contain specified annotations, with values matching provided regular expressions. spec: crd: spec: names: kind: K8sRequiredAnnotations validation: openAPIV3Schema: type: object properties: message: type: string annotations: type: array description: >- A list of annotations and values the object must specify. items: type: object properties: key: type: string description: >- The required annotation. allowedRegex: type: string description: >- If specified, a regular expression the annotation's value must match. The value must contain at least one match for the regular expression. targets: - target: admission.k8s.gatekeeper.sh rego: | {{ file.Read "src/general/requiredannotations/src.rego" | strings.Indent 8 | strings.TrimSuffix "\n" }}