mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-06 03:57:52 +09:00
A tenant's GPU budget is declared per class as <class>.gpuclass.cozystack.io/devices and over every class as gpuclass.cozystack.io/devices. These keys are not pod resources, so no ResourceQuota enforces them. The proposal hands the check to the pool-wide admission gate that counts declared sizes; until that gate is on, the Cozystack API server does it for GPU keys only, with the inputs and the pool arithmetic that gate reads, so the switch changes no verdict. On a VMInstance or KubernetesNodes create or update, every class entry reserves its count, times maxReplicas for a worker pool, read from the chart-defaulted values. The tenant pool arithmetic is applied to the declared resourceQuotas and these entries. Only growth is checked on an update, so shrinking and unchanged entries pass even in a pool that is already over budget. Like the gate it stands in for, this is a read-check-write without a transaction. The tenant declaration gate already treats GPU keys like any other; it now reads their pool usage from the class entries, since the ResourceQuota it reads for other keys never carries them. It also refuses a key in the GPU budget domain that is not a budget key: the tenant chart keeps such a key out of the ResourceQuota, so nothing would enforce it. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>