Files
cozystack/internal
Aleksei Sviridkin 94d710e50f fix(tenant): render the LimitRange only under a compute quota (#4954)
## What this PR does

The tenant chart rendered `tenant-range-limits` whenever
`resourceQuotas` was non-empty. Under a quota on something other than
compute, for example `{services.loadbalancers: "1"}`, `storage` or
`nvidia.com/gpu` alone, its 128Mi default memory limit still applied to
every container and refused any pod that requests more memory without a
limit of its own. virt-launcher is one of those, so VMs could not start
in such a tenant.

The LimitRange exists so pods without requests or limits pass a quota
that tracks `cpu`, `memory` or `ephemeral-storage`. This PR has it
default each of those three only when the flattened quota bounds that
resource (its `requests.*` or `limits.*` key), and renders no LimitRange
when the quota bounds none of them. A quota on all three renders the
LimitRange exactly as before, with the same values. The ResourceQuota is
unchanged. The system memory limits guide has moved to the website and
described the old condition in two places; the follow-up below updates
it. A second commit qualifies the comments in the operator, the tenant
quota controller, the backup controller and the barman and kafka charts
that still said every tenant with `resourceQuotas` gets a 128Mi memory
default.

Tests:

- New `packages/apps/tenant/tests/quota_limitrange_test.yaml` (9 tests):
no LimitRange under a quota on load balancers, storage or GPUs alone;
only the cpu, only the memory, or only the ephemeral-storage defaults
under a quota on that resource alone; only memory beside non-compute
keys; every default, values unchanged, under a quota on all three.
- Against main's template, 7 of the 9 tests fail. The two that pass are
the empty quota and the full cpu, memory and ephemeral-storage quota,
which keep their behaviour.
- `helm unittest` for the whole tenant chart: 23 suites, 98 tests pass.
- `helm template` of `templates/quota.yaml` under `{cpu, memory,
ephemeral-storage}` is identical to main.

I did not reproduce the virt-launcher admission failure on a live
cluster; the reproduction in the issue is from a test cluster on main.

Fixes #4930

### Screenshots

Not a UI change.

### Downstream repositories

- [ ] No downstream repository is affected by this change
- [x] [cozystack/website](https://github.com/cozystack/website) -
follow-up: cozystack/website#817
- [ ]
[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(tenant): the tenant LimitRange now defaults cpu, memory and ephemeral-storage only when resourceQuotas bounds that resource, so a quota without memory no longer gives containers a 128Mi default memory limit that kept VMs from starting.
```


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

## Summary by CodeRabbit

* **Bug Fixes**
* LimitRange settings are now rendered only when quotas bound CPU,
memory, or ephemeral storage. Defaults are included only for the bounded
resources; quotas limited to load balancers, storage, or GPUs do not
trigger a LimitRange on their own.
* **Documentation**
* Clarified when tenant namespaces receive LimitRange defaults,
including the resource-specific conditions for CPU, memory, and
ephemeral storage.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-23 20:24:30 +03:00
..