Files
cozystack/pkg
Mattia Eleuteri 89aba6e104 feat(api): add the reservation evaluator for tenant quotas
Tenant quotas are declared in instance-type units but enforced against
ResourceQuota.status.used, which counts virt-launcher pods with their
additive virtualization overhead and drifts without recomputation. The
accepted tenant-quota-reservation design makes the declared reservation
the accounting authority instead; this is its first phase, the
evaluator, with no consumer yet.

A kind describes its consumption as CEL over its values, so the
evaluator carries no per-kind knowledge and an out-of-tree kind
participates without a change here. Instance types resolve to scalars
keyed by class, read from the type's spec rather than its name, because
a pinned core, a hugepage and an overcommitted page are not the same
capacity as a shared vCPU or ordinary memory. KubeVirt pins the
emulator thread's parity core per type, from the annotations the type
hands to its VMs, so the classifier reads it there too. Anything that
does not resolve is an error, never a smaller figure.

Stored values carry only the keys a tenant wrote, so the evaluator
defaults them first. The defaulting code moves out of the application
registry into its own package so both read the same defaults. Defaulting
replaces a value of the wrong type with the schema's default, which
would turn a malformed spec into a smaller reservation, so values are
type-checked against the schema before it runs.

Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
2026-11-09 11:35:53 +01:00
..