Skip to content

feat: add target match conditions to mutating policies - #112

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

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

Conversation

@realshuting

@realshuting realshuting commented Jul 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • add targetMatchConditions to MutatingPolicySpec
  • document trigger and target evaluation ordering, including variable visibility
  • document target subresource routing
  • regenerate deepcopy code, CRDs, Helm CRDs, and API reference docs

This is the API portion of kyverno/kyverno#16612. The Kyverno implementation will consume this field after the API dependency is updated.

Validation

  • go test ./api/policies.kyverno.io/v1alpha1 ./api/policies.kyverno.io/v1beta1
  • verified make codegen is idempotent

@realshuting realshuting self-assigned this Jul 16, 2026
@realshuting
realshuting enabled auto-merge (squash) July 16, 2026 08:52
@realshuting
realshuting requested a review from Copilot July 16, 2026 08:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends Kyverno’s mutating policy API to support additional, post-resolution filtering of mutation targets via a new targetMatchConditions field, and updates the generated CRDs/Helm templates/docs to describe the evaluation order and target routing behavior.

Changes:

  • Add targetMatchConditions to MutatingPolicySpec and regenerate deepcopy code.
  • Update CRD schemas (standalone + aggregated) and Helm CRD templates to include the new field and updated descriptions.
  • Update generated CRD HTML/reference docs to reflect trigger vs target evaluation ordering and subresource routing (e.g., pods/resize).

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/user/crd/kyverno_cel_policies.v1alpha1.html Generated CRD docs updated to include targetMatchConditions and revised evaluation/routing text.
docs/user/crd/index.html Generated consolidated CRD index updated for the new field and revised descriptions across versions.
config/crds/policies.kyverno.io_namespacedmutatingpolicies.yaml Namespaced MutatingPolicy CRD schema updated with targetMatchConditions and revised descriptions.
config/crds/policies.kyverno.io_mutatingpolicies.yaml Cluster MutatingPolicy CRD schema updated with targetMatchConditions and revised descriptions.
config/crds.yaml Aggregated CRDs bundle updated to include the new schema and docstrings.
charts/kyverno-api/templates/crds/policies.kyverno.io_namespacedmutatingpolicies.yaml Helm-packaged Namespaced MutatingPolicy CRD updated to match new schema/docs.
charts/kyverno-api/templates/crds/policies.kyverno.io_mutatingpolicies.yaml Helm-packaged MutatingPolicy CRD updated to match new schema/docs.
api/policies.kyverno.io/v1alpha1/zz_generated.deepcopy.go Regenerated deepcopy logic to copy TargetMatchConditions.
api/policies.kyverno.io/v1alpha1/mutating_policy.go API type docs updated; new TargetMatchConditions field added with merge/list markers.
Files not reviewed (1)
  • api/policies.kyverno.io/v1alpha1/zz_generated.deepcopy.go: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@realshuting
realshuting force-pushed the feat/mpol-target-match-conditions branch from fd5f792 to 2b0d363 Compare July 16, 2026 08:56
Signed-off-by: realshuting <shuting@nirmata.com>
@realshuting
realshuting force-pushed the feat/mpol-target-match-conditions branch from 2b0d363 to e2d1708 Compare July 16, 2026 09:02
@realshuting
realshuting merged commit 8729d40 into kyverno:main Jul 16, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants