Repository navigation
feat(kyverno): migrate validate-pdb-drain-safe to ValidatingPolicy - #5119
Conversation
Rewrite the policy as a ValidatingPolicy with the same Audit action, the same disruption-budget scope and the same three exclusions (CloudNativePG-managed, KSail-installed and Longhorn-managed budgets), and record it by name in the failure-action baseline. Fixes #5118 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
devantler
left a comment
There was a problem hiding this comment.
🤖 Generated by the Agentic Engineer
Self-review (fallback — CodeRabbit, Codex and Cursor Bugbot unavailable)
Reviewed commit: 04f3d529e7685a26f7872e8829566a2d04f98b59
- CodeRabbit: rate limited — its 10:25Z review on platform#5116 used the plan's one included review for this hour ("0 remain after this review"); no artifact exists on this PR.
- Codex: usage limit since 2026-10-19 22:44Z (lane-health read 09:44Z today); no Codex artifact on this PR.
- Cursor Bugbot: usage limit since 2026-10-19 22:18Z (lane-health read 09:44Z today); no Bugbot check-run on this PR.
Scope read: the whole diff against main. Checked with Kyverno CLI 1.19.1 (the running version): this policy's test 7/7 with each fail carrying the expected message and each exclusion reporting skip, the whole suite 752/752, the per-rule fixture gate, and the failure-action baseline on source and on the production render. Evaluated old and new policy against production's live disruption budgets (read-only, names, the CloudNativePG label and the budget fields only): 54 pass and 0 fail under both; the 18 the old policy excluded are reported as skip by the new one.
Correctness: the three exclusions are carried over one for one. The Longhorn name pattern requires at least one character after the prefix, as the old wildcard did, and applies only inside the Longhorn namespace. Any set minimum-available value fails, including zero, as before. The Audit action and background evaluation are preserved.
Security: no trust, execution or egress boundary changes; the policy stays Audit.
Verdict: no P0/P1 findings
Readiness — head
|
Why
The next Kyverno release removes the older policy kind. The rule that warns when a disruption budget could make a node impossible to drain still uses that kind, so it would stop working on upgrade.
What
The same rule is rewritten in the newer policy kind. It keeps the same behaviour: it reports, without blocking, budgets that set a minimum-available count, and it still leaves alone the budgets that the database operator, KSail's own install and the storage system manage themselves.
Fixes #5118