Repository navigation
fix(guards): admit a system-namespace exclusion on the reviewed auto-vpa GeneratingPolicy - #5127
Conversation
…vpa GeneratingPolicy Both static guards now accept the catalog auto-vpa GeneratingPolicy with an optional matchConstraints.namespaceSelector whose only field is matchExpressions, each kubernetes.io/metadata.name NotIn a list of names. A label selector is not CEL and only narrows which workloads trigger the policy. matchLabels, other operators, other keys, empty lists and an objectSelector stay refused, each with a negative control. Fixes #5125 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai review |
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 41 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ed fixture The namespace-selector variants now assert they differ from the fixture they were derived from, so a substitution that silently fails to match reports as such. Adds the empty matchExpressions case on the CEL side; a non-string value or an extra expression field is rejected by the CRD schema before the rule is evaluated, so those cases stay covered by the bash guard's tests. 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: ea10b3b39c1693f2e29b9f57def40aaeb35c75fe
- CodeRabbit: rate limited — its reply to the 11:42Z request at the previous head says the free OSS review limit is used up, next review in ~41 minutes; no CodeRabbit review exists on this PR.
- Codex: usage limit since 2026-10-19 22:44Z (lane-health read 11:12Z today); no Codex artifact on this PR.
- Cursor Bugbot: usage limit since 2026-10-19 22:18Z (lane-health read 11:12Z today); no Bugbot check-run on this PR.
Scope read: the whole diff against main, plus an independent read-only review pass over both guards. Ran both suites locally at this head: the bash guard's suite (0 failures, 9 new negative controls) and the egress-rule suite (PASS, 6 new cases on Kyverno CLI). Control run: with the old rule file the egress suite fails on exactly the new accept case, so the test exercises the change.
Correctness: both guards accept the catalog policy with or without the selector and refuse matchLabels, In/Exists, another label key, empty expression or value lists, and an objectSelector. On the bash side a non-map element makes yq fail and the guard refuses ("could not read"), which fails closed; null, aliases and merge keys are refused by the type and key checks. On the CEL side a non-string value or an extra expression field is rejected by the CRD schema before the rule runs, so those two cases are tested on the bash side only. CI at the previous head was all green.
Security: the only newly admitted field is a namespace label selector that can only exclude named namespaces. It is not CEL, so it cannot read or write the cluster or change what is generated, and the generated object stays the reviewed VerticalPodAutoscaler. No production manifest changes.
Nits (not blocking): the CEL side raises an evaluation error rather than returning false on a null or list-typed selector. The existing branch already behaves that way for other fields, and the CRD schema rejects those shapes first.
Verdict: no P0/P1 findings
Readiness at
|
Why
The platform is moving its automatic resource-sizing policy to the shared catalog's newer form before the next policy-engine upgrade removes the old one. The platform must keep that policy out of four system namespaces, where it already sizes controllers another way; without the exclusion, those controllers would get two competing sizing rules. The safety checks refuse the shared policy as soon as the exclusion is added.
What
The safety checks now also accept the shared sizing policy when it carries a list of namespaces to skip. Only a plain "skip these named namespaces" list is allowed; selecting namespaces, matching on other labels, empty lists, or filtering workloads by label are still refused, with a test for each. Nothing deployed changes in this pull request; switching the policy over is the next step.
Fixes #5125