Skip to content

docs: document MutatingPolicy target conditions and subresource targets - #2096

Merged
realshuting merged 2 commits into
kyverno:mainfrom
realshuting:docs/mpol-target-match-conditions
Jul 20, 2026
Merged

realshuting merged 2 commits into
kyverno:mainfrom
realshuting:docs/mpol-target-match-conditions

Conversation

@realshuting

Copy link
Copy Markdown
Member

Related issue

kyverno/kyverno#16612

Documents the MutatingPolicy features implemented in kyverno/kyverno#16614 with the API fields from kyverno/api#112.

Proposed Changes

Extends the MutatingPolicy page's "Mutating Existing Resources" section:

  • Evaluation Order: documents the two-phase flow — trigger (matchConstraints → matchConditions → variables → targetMatchConstraints resolution) and target (target rule matching → targetMatchConditions → mutations → persistence through the declared route). Notes that variables are lazily available in trigger matchConditions (at most once, on first reference) and the native MutatingAdmissionPolicy autogen caveat, matching docs: align match condition variable semantics with implementation api#113.
  • Filtering Targets with targetMatchConditions: documents the new field with an example filtering targets by combining target state (object) with trigger data (variables).
  • Mutating Subresources: documents subresource routing for target resource rules, with an in-place Pod vertical scaling example through pods/resize (Kubernetes 1.33+) and the RBAC note for the background controller.
  • Notes that targetMatchConstraints.expression may reference trigger-derived variables.

Examples mirror the conformance-tested policies from kyverno/kyverno#16614.

Checklist

  • I have read the contributing guidelines.
  • I have inspected the website preview for accuracy.
  • I have signed off my issue.

Signed-off-by: realshuting <shuting@nirmata.com>
Assisted-by: GitHub Copilot
@realshuting realshuting self-assigned this Jul 20, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation webhook Admission webhook documentation and policies labels Jul 20, 2026
Signed-off-by: realshuting <shuting@nirmata.com>
Assisted-by: GitHub Copilot
@realshuting
realshuting marked this pull request as ready for review July 20, 2026 14:48
@realshuting
realshuting enabled auto-merge (squash) July 20, 2026 14:48
@realshuting
realshuting merged commit 90f0c44 into kyverno:main Jul 20, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation webhook Admission webhook documentation and policies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants