Repository navigation
fix(cozy-lib): render tenant hugepages quota only as requests - #5189
europrinter (yankawai) wants to merge 1 commit into
Conversation
A tenant with hugepages-2Mi or hugepages-1Gi in resourceQuotas got both requests.hugepages-<size> and limits.hugepages-<size> in tenant-quota. A ResourceQuota accepts huge pages only as hugepages-<size> or requests.hugepages-<size>, so the apiserver rejects tenant-quota and the tenant release fails to install or upgrade. Huge pages are not counted in limits.memory either, so without this key a VM whose memory is backed by huge pages runs outside the tenant quota. The limits side is dropped for hugepages-* the same way it already is for storage. sanitize still emits equal requests and limits, which is what a pod spec needs for huge pages, so only the quota rendering changes. Signed-off-by: Yan Bondarenko <[email protected]> Assisted-by: LLM
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38a32445f7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| {{- else if and (eq $section "limits") (hasPrefix "hugepages-" $type) }} | ||
| {{- $out = "" }} |
There was a problem hiding this comment.
Update admission's huge-page key mapping alongside the renderer
When a parent tenant already consumes huge pages, the unchanged renderedLimitKey in pkg/registry/apps/application/quota.go:299-306 still maps these resources to limits.hugepages-*, and validateTenantResourceQuotas uses that mapping to read parent-pool usage at line 236. With this requests-only rendering, the recorded usage is under requests.hugepages-*, so admission reads zero instead. For example, a parent with a 4Gi budget already using 3Gi will incorrectly admit a child requesting 2Gi. Update the admission mapping and its regression tests alongside this change so child reservations account for existing huge-page consumption.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Covered by #5184, which reads parent pool usage of hugepages-<size> from requests.hugepages-<size>, the side the quota controller counts. Without it the child check still reads limits.hugepages-*, which never shows up in status.used, so the two should land together or #5184 first. It is not a regression in between, before this PR a tenant with a hugepages quota did not install at all, so there was no usage to read either. The trailers are on 38a3244, Signed-off-by and Assisted-by: LLM.
| {{- $out := "" }} | ||
| {{- if and (eq $section "limits") (eq $type "storage") }} | ||
| {{- $out = "" }} | ||
| {{- /* |
There was a problem hiding this comment.
Include the required commit trailers
The reviewed commit has no trailer block, so it contains neither Signed-off-by: nor Assisted-by: LLM. AGENTS.md requires commits “with --signoff” and an assistance trailer for agent-assisted work; the linked docs/agents/contributing.md explicitly makes a missing DCO sign-off a review blocker. Include both required trailers before merging this change.
AGENTS.md reference: AGENTS.md:L71-L71
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The PR has one commit, 38a3244, with Signed-off-by and a single Assisted-by: LLM, and hack/check-commit-trailers.sh origin/main..HEAD passes, so this reads some other commit.
| {{- if and (eq $section "limits") (eq $type "storage") }} | ||
| {{- $out = "" }} | ||
| {{- /* | ||
| A ResourceQuota accepts hugepages only as requests.hugepages-<size>, |
There was a problem hiding this comment.
Keep the commit body focused on the reason for the change
The reviewed commit embeds the PR template, including implementation narration (flattenResource now drops the limits side), test results, a Screenshots section, and the downstream checklist. AGENTS.md requires commit bodies to explain “WHY, not a narration of WHAT”, and the linked docs/agents/contributing.md Review Blockers section explicitly rejects bodies that walk through the diff. Retain the failure and rationale in the commit body and keep the PR-template material outside it.
AGENTS.md reference: AGENTS.md:L72-L72
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Same here, the body of 38a3244 has only the failure and the reason, the PR template is not in it.
What this PR does
A tenant with
hugepages-2Miorhugepages-1GiinresourceQuotasgets bothrequests.hugepages-<size>andlimits.hugepages-<size>intenant-quota. Kubernetes accepts huge pages in a ResourceQuota only ashugepages-<size>orrequests.hugepages-<size>(IsStandardQuotaResourceName), so the apiserver rejectstenant-quotaand the tenant release fails to install or upgrade. Huge pages are not counted inlimits.memoryeither, so today a VM whose memory is backed by huge pages runs outside the tenant quota with no way to bound it.cozy-lib.resources.flattenResourcenow drops the limits side forhugepages-*, the same way it already does forstorage, so the quota carries onlyrequests.hugepages-<size>. Both page sizes go through the same rule.sanitizeis unchanged: a pod spec still needs equal requests and limits for huge pages.helm unittest .passes 69 of 69 inpackages/tests/cozy-lib-testsand 78 of 78 inpackages/apps/tenant. The new case fails onmainon bothlimits.hugepages-*keys. Admission reads hugepages usage fromrequests.*after #5184, which matches what this renders.Screenshots
Not a UI change.
Downstream repositories
Template change in
cozy-lib, one new test case and one line in the hand-written part ofpackages/apps/tenant/README.md. No values key, schema or default changes. The website tenant reference page is regenerated from that README on release, so no trigger map entry needs a manual follow-up.Release note
Summary by CodeRabbit