mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-03 02:27:01 +09:00
GPUs become a catalog of hoster offers, tenant claims against them and a per-node inventory, so a tenant can hold a GPU while its VM is off and an order that does not fit is refused at create time. The CRDs enforce what the apiserver alone can: a class name is a DNS label other than total because it becomes part of a quota key, the source is a union with dra reserved for a later member, a class's mode never changes because a pool that names the class takes its worker template from it, a claim's spec is immutable and orders at least one GPU, and bound claims are listable per node through a field selector on status.nodeName. A class resource name must have the shape of an extended resource name and lie outside gpu.cozystack.io, where it would read as a GPU budget key. The CRDs are kept on chart uninstall, since they ship as plain templates and deleting GPUClaim would drop every hold and usage record. A class carries the tolerations of its VMs. A claim is bound when it is ordered, before any pod exists, so a dedicated taint on GPU nodes can only be checked against the class; without them such a node would serve no class at all. The tolerations are copied onto launcher pods, so the class takes only what pod validation accepts on every cluster: Exists and Equal, since Gt and Lt are refused where their feature gate is off, and the key, value, effect and tolerationSeconds rules of a pod toleration. They are a type of their own rather than the core one, because the core type carries no schema to put length limits on, and without them the checks would not fit the CEL cost budget. A claim records the nodes that refused its set's pinned launcher pod, each with an expiry, in status, so a leader change does not forget them and the controller does not pin the set to the same node again on its next pass. maxCount carries no schema default: it defaults to 1 for vgpu classes and to no limit for passthrough, which a structural default cannot express, so readers resolve it through the shared model. A GPUNode device reports how many device-plugin devices kubelet counts as allocatable for it, because an mdev parent serves several from one PCI function and one healthy entry per function would undercount the node. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>