Repository navigation
fix: match regolibrary memory defaults in C-0004, C-0269 and C-0271 - #216
Conversation
The bundle set memoryRequestMin 0.125Gi, memoryLimitMin 0.25Gi and 4Gi maxima, while regolibrary defaults the minima to 0 and leaves the maxima empty. The Rego rules therefore pass a 64Mi request or a 128Mi limit that the CEL policies rejected. Relax the shipped parameters to the Rego defaults and treat an empty maximum as no upper bound. Keep the bounded values in a separate test template so the range checks stay covered. Signed-off-by: sapnasingh4852-source <sapnasingh4852-source@users.noreply.github.com>
An empty maximum means no upper bound. State the shipped 0 minimum and empty maximum so readers know that only field presence is enforced by default. Signed-off-by: sapnasingh4852-source <sapnasingh4852-source@users.noreply.github.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
matthyx
left a comment
There was a problem hiding this comment.
Request changes (one policy blocker). Reviewed head c6eb418 against main.
Blocker – missing Before/After proof (project policy). The description lists verification steps, but there is no same-command/same-input comparison on main vs this PR. Please add the failing-then-passing output, e.g. the new pass cases (C-0004 64Mi/128Mi, C-0269 64Mi, C-0271 128Mi, 5Gi/6Gi deployment) rejected on main and accepted here, or the TestRegoCELParity known-gap output from #215 before/after.
Question (non-blocking, needs a maintainer): #215 explicitly asks maintainers to choose between (1) moving regolibrary defaults to the bundle's bounds or (2) relaxing the bundle. No maintainer decision is on the issue; the PR takes option 2. Please confirm option 2 before merge, since it weakens the default memory bounds for existing users.
Findings: the change itself looks sound. Max comparisons skip on ""; 0 min reduces to a presence check; defaults match regolibrary default-config-inputs.json; bounded values are kept in memory-range-control-configuration.yaml with the range tests opted in; docs are updated. No duplicate or superseded PRs found (related merged: #160, #198, #79; none rejected). Author has 1 open PR. No existing reviews.
CI: green on this commit (test-all-policies, test-policy-expressions, DCO, GitGuardian, FOSSA, CodeRabbit; main-policy-automation run succeeded). I did not run the minikube suite locally; the review was static.
Once the Before/After proof is added and option 2 is confirmed, this is ready to approve.
|
added the before/after proof to the description at c6eb418. no cluster here. same command on both trees: policy.yaml and test-resources/default-control-configuration.yaml from each commit, evaluated with the k8s apiserver cel library against the same objects. C-0004 pod 64Mi/128Mi denied on main 894e34b, allowed here on option 2: defaults now match regolibrary default-config-inputs.json, min 0 and empty max. cel no longer rejects values rego accepts. a range stays opt-in through ControlConfiguration. option 1 would change rego for existing users instead. can you confirm option 2 or should i flip the pr to option 1. |
Fixes #215.
The bundle set
memoryRequestMin 0.125Gi,memoryLimitMin 0.25Giand 4Gi maxima, while regolibrary'sdefault-config-inputs.jsonsets both minima to"0"and leaves the maxima empty. The Rego rules for C-0269 and C-0271 only check that the field is set, so a 64Mi request or a 128Mi limit passed Rego and failed CEL.Changes:
configuration/basic-control-configuration.yamland the test default now use a0minimum and an empty maximum, matching the Rego defaults.""as no upper bound. The minimum comparison is unchanged;0turns it into a presence check.test-resources/memory-range-control-configuration.yamlkeeps the old bounded values, and the range-dependent tests opt into it.Before / after
kubectl,minikubeanddockerare not available on this machine, so the minikube suite stays with CI. The comparison below runs one command on both trees: it readscontrols/C-XXXX/policy.yamlandtest-resources/default-control-configuration.yamlfrom the given commit and evaluates them with the Kubernetes CEL library the API server uses (k8s.io/apiserver/pkg/cel/library.QuantityandLists) against the same generated objects.894e34bc6eb418Denied means every validation expression returned
false. Withmemory-range-control-configuration.yamlthe bounded checks still deny the out-of-range values: C-0004 request 64Mi, C-0004 5Gi/6Gi and C-0271 limit 4.1Gi all returnfalse. Only the unbounded default changes.This takes option 2 from the issue: the bundle follows the Rego defaults, and enforcing a range stays opt-in through the
ControlConfiguration. Moving regolibrary to the tighter bounds instead would be the reverse change in regolibrary; happy to switch if maintainers prefer option 1.Summary by CodeRabbit