Files
cozystack/packages/apps
Aleksei Sviridkin 060686cbc0 fix(cozy-lib): render tenant hugepages quota only as requests (#5189)
## What this PR does

A tenant with `hugepages-2Mi` or `hugepages-1Gi` in `resourceQuotas`
gets both `requests.hugepages-<size>` and `limits.hugepages-<size>` in
`tenant-quota`. Kubernetes accepts huge pages in a ResourceQuota only as
`hugepages-<size>` or `requests.hugepages-<size>`
([`IsStandardQuotaResourceName`](https://github.com/kubernetes/kubernetes/blob/v1.34.1/pkg/apis/core/helper/helpers.go#L245)),
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 today a VM whose memory is backed by huge pages runs outside
the tenant quota with no way to bound it.

`cozy-lib.resources.flattenResource` now drops the limits side for
`hugepages-*`, the same way it already does for `storage`, so the quota
carries only `requests.hugepages-<size>`. Both page sizes go through the
same rule. `sanitize` is unchanged: a pod spec still needs equal
requests and limits for huge pages.

`helm unittest .` passes 69 of 69 in `packages/tests/cozy-lib-tests` and
78 of 78 in `packages/apps/tenant`. The new case fails on `main` on both
`limits.hugepages-*` keys. Admission reads hugepages usage from
`requests.*` 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 of `packages/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.

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
fix(cozy-lib): a tenant quota with hugepages-2Mi or hugepages-1Gi now renders only requests.hugepages-<size>, so the tenant installs and its huge pages are bounded.
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Huge-page quotas now apply only to requests, avoiding unsupported
limit entries in Kubernetes resource quotas. Quota entries for 2 MiB and
1 GiB huge pages are retained as requests, while corresponding limit
entries are omitted.
* **Documentation**
* Clarified that 2 MiB and 1 GiB huge-page resources are represented as
requests in resource quotas, not limits, because Kubernetes does not
support huge-page limits quotas.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-16 22:05:56 +03:00
..
2025-08-07 14:07:05 +03:00

How to test packages local

cd packages/core/installer
make image-cozystack REGISTRY=YOUR_CUSTOM_REGISTRY
make apply
kubectl delete po -l app=source-controller -n cozy-fluxcd