Reference
Policy templates
The nine built-in templates a protection plan can use, with the kinds, operations and parameters each one renders.
A protection plan selects templates by id in spec.policies[].templateID.
Discovery renders each selected template into one Kyverno
NamespacedValidatingPolicy per scope namespace.
GET /api/v1/policytemplates returns this catalog. The dashboard shows
each template by its label, which names the operation, since the API
name says "Block …" even in audit mode. How plans use templates is
explained in Protection plans.
Catalog
| ID | Code | Name | Dashboard label | Operations | Kinds | Scopes | Parameters |
|---|---|---|---|---|---|---|---|
block-create | bc | Block Resource Creation | Creating any resource | CREATE | Every kind | applications, namespaces | none |
block-update | bu | Block Resource Updates | Updating any resource | UPDATE | Every kind, plus the /scale subresource of Deployment, StatefulSet, ReplicaSet and ReplicationController | applications, namespaces | none |
block-delete | bd | Block Resource Deletion | Deleting any resource | DELETE | Every kind | applications, namespaces | none |
block-image-types | bit | Block Image Patterns | Images matching blocked patterns | CREATE, UPDATE | Deployment, StatefulSet, DaemonSet, Job, CronJob | applications, namespaces | imagePatterns (required) |
block-image-tags | bitg | Block Image Tags | Images with blocked tags | CREATE, UPDATE | Deployment, StatefulSet, DaemonSet, Job, CronJob | applications, namespaces | tags (required) |
block-replica-scaling | brs | Block Replica Scaling | Changing replica counts | UPDATE | Deployment, StatefulSet and their /scale | applications | none |
block-storage-changes | bsc | Block Storage Changes | Creating, deleting or editing storage | CREATE, UPDATE, DELETE on PVCs; UPDATE of workload volumes | PersistentVolumeClaim, workloads | applications, namespaces | none |
block-config-secret-resource-changes | bcsr | Block ConfigMap and Secret Changes | Updating or deleting ConfigMaps & Secrets | UPDATE, DELETE | ConfigMap, Secret | applications, namespaces | none |
block-workload-config-mount-changes | bwcm | Block Workload Config Mount Changes | Changing config mounts & env sources | UPDATE | Workloads: volumeMounts, ConfigMap and Secret volumes, envFrom, configMapKeyRef and secretKeyRef in every container list | applications, namespaces | none |
Parameters
Parameters are string arrays. Every entry must match the pattern; an unknown parameter is refused.
| Template | Key | Pattern | Example |
|---|---|---|---|
block-image-types | imagePatterns | One glob per entry, no whitespace (^\S+$) | */untrusted-repo/* |
block-image-tags | tags | Docker tag grammar (^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$) | latest, dev, snapshot |
block-image-tags matches the parsed image tag. An image pinned by
digest has no tag and is not matched.
What every rendered policy shares
| Property | Value |
|---|---|
| Kind | Kyverno NamespacedValidatingPolicy (policies.kyverno.io/v1), evaluated only for requests in its own namespace |
| Name | telark-<plan id>-<template code>-<8 hex of sha256(namespace + application ids)> |
| Labels | telark.io/protection-plan=<plan id>, telark.io/template-id=<id>, app.kubernetes.io/managed-by=telark |
| Annotations | telark.io/plan-name, telark.io/created-by, telark.io/render-hash |
validationActions | Audit or Deny, from the plan's mode |
| Message | Names the plan as its author wrote it, quoted, and ends with the requester, for example Resource deletion is blocked by protection plan "Release freeze". (requested by "<username>"); audit mode reads "would be blocked" |
| Applied with | Server-side apply, field manager telark-protection-plans |
Scope and exemptions
- Applications scope: rules match the application's own resources by
name, per namespace.
block-createalso matches new resources that carry the application's identity label, so a resource joining the app is blocked too.block-storage-changesmatches PVCs by the claim names the workloads reference. - Namespaces scope: rules match every resource of the listed kinds in the namespace.
- Exclusions: the plan's excluded kinds and resources are added to
every policy's match conditions; an excluded kind or resource also
excludes its
/scalesubresource. - Kyverno's own
Policy,NamespacedValidatingPolicy,PolicyReportandEphemeralReportwrites are always exempt.block-create,block-updateandblock-deletealso exempt the Kubernetes controller manager, the scheduler andkube-systemservice accounts, so replacement Pods and rollout ReplicaSets keep working during a freeze. - CronJobs are evaluated at their own pod-template path.