Skip to content

docs: add YAML template mode to GeneratingPolicy - #2102

Merged
realshuting merged 3 commits into
kyverno:mainfrom
realshuting:feat/16331-gpol-template-docs
Jul 23, 2026
Merged

realshuting merged 3 commits into
kyverno:mainfrom
realshuting:feat/16331-gpol-template-docs

Conversation

@realshuting

Copy link
Copy Markdown
Member

Related issue / PR

Documents the YAML template mode for GeneratingPolicy proposed in kyverno/kyverno#16331 and implemented in kyverno/kyverno#16699 (API: kyverno/api#115), targeting Kyverno 1.19.

Proposed Changes

Adds a new YAML Templates section to the GeneratingPolicy page (between Data Source and Clone Source), marked beta v1.19:

  • Introduction and when-to-use guidance (YAML-first alternative to dyn()-heavy CEL object construction; migration path from ClusterPolicy generate rules); per-entry exclusivity of expression vs template
  • Field reference for template.value and template.interpolate (none default / cel)
  • A template-mode equivalent of the page's existing Data Source example, noting that rendered documents flow through the same generation runtime (synchronize / generateExisting / orphan / scope parity)
  • Placeholder Semantics: structural whole-value splice vs embedded string interpolation, with an annotated CiliumNetworkPolicy snippet (LabelSelector map splice, mixed static/interpolated toPorts); mapping-key restriction with the dynamic-keys workaround; \(( escaping; interpolate: none behavior
  • Generating Multiple Resources: multi-document template example
  • Namespace Targeting: per-document metadata.namespace, NamespacedGeneratingPolicy defaulting and cross-namespace denial, pointer to Looping for fan-out cases

Draft until kyverno/kyverno#16699 merges. Prettier-formatted; full astro build passes locally (762 pages).

Documents the new spec.generate[].template declaration mode shipping in
Kyverno 1.19 (kyverno/kyverno#16331): field reference, placeholder
interpolation semantics (structural splice vs string interpolation,
escaping, mapping-key restriction), multi-document generation, and
namespace targeting rules.

Signed-off-by: realshuting <shuting@nirmata.com>
The lint workflow resolves prettier fresh via yarn (no lockfile for
yarn), currently 3.9.6, which formats five pre-existing files
differently than the version they were committed with. Reformat them
with prettier 3.9.6 so format:check passes.

Signed-off-by: realshuting <shuting@nirmata.com>
The lint workflow resolves prettier fresh via yarn (repo has no yarn
lockfile), currently 3.9.6, which formats these pre-existing files
differently than the version they were committed with. Reformat with
prettier 3.9.6 so format:check passes.

Signed-off-by: realshuting <shuting@nirmata.com>
@github-actions github-actions Bot added blog Blog content webhook Admission webhook documentation and policies website-redesign Website content, design, and implementation labels Jul 22, 2026
@realshuting
realshuting marked this pull request as ready for review July 22, 2026 09:23
@realshuting
realshuting marked this pull request as draft July 22, 2026 09:23
@realshuting
realshuting marked this pull request as ready for review July 22, 2026 09:40
@realshuting
realshuting enabled auto-merge (squash) July 22, 2026 09:40
@realshuting
realshuting marked this pull request as draft July 22, 2026 09:40
auto-merge was automatically disabled July 22, 2026 09:40

Pull request was converted to draft

@realshuting
realshuting marked this pull request as ready for review July 22, 2026 09:53
@realshuting
realshuting enabled auto-merge (squash) July 22, 2026 09:53
@JimBugwadia
JimBugwadia self-requested a review July 23, 2026 07:05
@realshuting
realshuting merged commit 80b4daa into kyverno:main Jul 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blog Blog content documentation Improvements or additions to documentation webhook Admission webhook documentation and policies website-redesign Website content, design, and implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants