Repository navigation
Migrate Kyverno ClusterPolicy and Policy before Kyverno 1.20 removes them #4984
Description
🤖 Generated by the Agentic Engineer (interactive Claude Code session)
Evidence
- Kyverno 1.19 deprecates
ClusterPolicy,Policy,CleanupPolicy,ClusterCleanupPolicyand the legacykyverno.ioPolicyException, calls 1.19 the final release with full support for them, and plans their removal for 1.20, estimated November 2026. - Production runs Kyverno 1.19.1. The repository has 49
ClusterPolicymanifests and onePolicy; they carry almost every admission, mutation and generation rule the platform enforces. - The dependency rules for Kyverno do not hold it below 1.20, and KSail also installs Kyverno for the cluster (
policyEngine: Kyverno), so the version can move from two places.
Problem
Installing Kyverno 1.20 before the policies are migrated would remove the platform's admission rules in one deploy.
Smallest useful change
Cap Kyverno below 1.20 in the dependency rules, with the removal condition recorded beside the cap, and confirm which Kyverno version KSail installs. Then migrate the policies to their replacement kinds in small batches, each validated with the existing policy tests.
Acceptance criteria
- An update cannot propose Kyverno 1.20 while any legacy policy kind remains; the cap names its removal condition.
- Every
ClusterPolicy,Policyand legacy exception is migrated, and the policy tests pass on the new kinds. - The cap is removed and Kyverno 1.20 deployed only after the migration is live.
Size: large — the migration is the bulk; the cap is small.
Refinement (2026-10-17): decomposed
Corrected count. main has 49 kyverno.io/v1 ClusterPolicy manifests (22 validate, 23 mutate, 4 generate; none mixes rule types or uses verifyImages) and no kyverno.io Policy, CleanupPolicy, ClusterCleanupPolicy or legacy PolicyException. The platform already runs two new-style kinds: ImageValidatingPolicy (verify-app-images) and DeletingPolicy (prune-stale-policy-reports). 28 of the 49 are named in no Kyverno CLI test, so each batch starts by pinning current behaviour.
Children, in the order they can start:
- Hold Kyverno below 1.20 while any ClusterPolicy remains #4994 — hold Kyverno below 1.20 while any
ClusterPolicyremains, and record what KSail installs. Ready. - Migrate the tenant and organisation validation ClusterPolicies to ValidatingPolicy #4995 — 12 tenant and organisation validation policies →
ValidatingPolicy. Ready. - Migrate the workload, Flux and provider validation ClusterPolicies to ValidatingPolicy #4996 — 10 workload, Flux and provider validation policies →
ValidatingPolicy. Ready. - Migrate the workload-default and HelmRelease mutation ClusterPolicies to MutatingPolicy #4997 — 11 workload-default and HelmRelease mutation policies →
MutatingPolicy. Ready. - Migrate the production storage-placement mutation ClusterPolicies to MutatingPolicy #4998 — 12 production storage-placement mutation policies →
MutatingPolicy. Backlog until the existing-resource handover is decided. - Migrate the namespace-default generation ClusterPolicies to GeneratingPolicy without a gap #4999 — 4 synchronised generation policies →
GeneratingPolicy. Backlog until the handover of the objects they generated is decided.
The last criterion above (remove the cap and install 1.20) follows once every child is closed and 1.20 is released. This issue is now an Epic: it is delivered through its children.
Metadata
Metadata
Assignees
Labels
Type
Fields
Projects
- StatusShow more project fields📥 Backlog
Activity
devantler commentedon Oct 17, 2026
Coordination note from today's kyverno-policies strategy review: the shared catalog now has devantler-tech/kyverno-policies#42 to port its own six classic policies to CEL kinds before Kyverno 1.20, and devantler-tech/kyverno-policies#45 to decide which of this repository's 49 classic policies are generic enough to port once in the catalog instead of here. Porting a generic policy in the catalog costs about the same and the platform template inherits it. Suggest starting this migration with the platform-specific policies and leaving the generic candidates until #45 records its decision.
devantler commentedon Oct 19, 2026
What the platform should not port itself — decided on devantler-tech/kyverno-policies#45 (2026-10-19):
Precondition: the platform does not reference the catalog today. Until it consumes it (devantler-tech/kyverno-policies#9), none of the 15 can be removed from the platform; if that is not live in time for 1.20, the platform ports them in place after all.
For #4996 this means: disallow-latest-tag and enforce-flux-best-practices are retired rather than rewritten here; validate-host-restrictions, validate-pdb-drain-safe and validate-pod-security graduate; validate-replica-ceiling, validate-replica-floor and the three Hetzner provider policies are ported in place. Their CLI tests already exist and stay as the acceptance check either way.