From 82347bf5f5c783f207e215375bb7e2fb3b521842 Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Tue, 3 Nov 2026 06:29:52 +0300 Subject: [PATCH] feat(vm-instance): name a GPUClass and a count in gpus Tenants need to select an offer independently of the hoster's device- plugin naming. Class references preserve that distinction when the backend resource name changes. Mixing raw GPU entries with class references would create two sources of GPU requests on one VMI. A homogeneous list avoids that ambiguity. A cluster without the resolving webhook must refuse references rather than silently boot a VM without its requested GPUs. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin --- api/apps/v1alpha1/vminstance/types.go | 8 +- packages/apps/vm-instance/README.md | 4 +- packages/apps/vm-instance/templates/vm.yaml | 13 +- .../apps/vm-instance/tests/gpus_test.yaml | 155 ++++++++++++++++++ packages/apps/vm-instance/values.schema.json | 16 +- packages/apps/vm-instance/values.yaml | 10 +- packages/library/cozy-lib/templates/_gpu.tpl | 51 ++++++ .../vm-instance-rd/cozyrds/vm-instance.yaml | 2 +- 8 files changed, 245 insertions(+), 14 deletions(-) create mode 100644 packages/apps/vm-instance/tests/gpus_test.yaml create mode 100644 packages/library/cozy-lib/templates/_gpu.tpl diff --git a/api/apps/v1alpha1/vminstance/types.go b/api/apps/v1alpha1/vminstance/types.go index f30e8dee8..9d918fd0f 100644 --- a/api/apps/v1alpha1/vminstance/types.go +++ b/api/apps/v1alpha1/vminstance/types.go @@ -102,8 +102,12 @@ type Firmware struct { } type GPU struct { - // The name of the GPU resource to attach. - Name string `json:"name"` + // GPUClass to take GPUs of. + ClassName string `json:"className,omitempty"` + // GPUs of the class; 1 when unset. + Count int `json:"count,omitempty"` + // Resource name of the GPU to request directly. + Name string `json:"name,omitempty"` } type Network struct { diff --git a/packages/apps/vm-instance/README.md b/packages/apps/vm-instance/README.md index 1b495342e..77fc35e22 100644 --- a/packages/apps/vm-instance/README.md +++ b/packages/apps/vm-instance/README.md @@ -55,7 +55,9 @@ virtctl ssh @ | `subnets[i].name` | Network attachment name. | `string` | `""` | | `routeTable` | Name of a cozyplane RouteTable in the VM's namespace that routes the VM's traffic. Empty uses the VPC's default table. Requires the cozyplane networking variant and a VPC in `networks`. | `string` | `""` | | `gpus` | List of GPUs to attach (NVIDIA driver requires at least 4 GiB RAM). | `[]object` | `[]` | -| `gpus[i].name` | The name of the GPU resource to attach. | `string` | `""` | +| `gpus[i].name` | Resource name of the GPU to request directly. | `string` | `""` | +| `gpus[i].className` | GPUClass to take GPUs of. | `string` | `""` | +| `gpus[i].count` | GPUs of the class; 1 when unset. | `int` | `0` | | `cpuModel` | Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map | `string` | `""` | | `firmware` | Firmware and boot configuration (UEFI/BIOS selection, Secure Boot, persistent EFI NVRAM). | `object` | `{}` | | `firmware.bootloader` | Bootloader to boot the VM with: "uefi" (OVMF) or "bios" (SeaBIOS). Empty inherits the instanceProfile default. | `string` | `""` | diff --git a/packages/apps/vm-instance/templates/vm.yaml b/packages/apps/vm-instance/templates/vm.yaml index d7288a61e..d7bbd1cce 100644 --- a/packages/apps/vm-instance/templates/vm.yaml +++ b/packages/apps/vm-instance/templates/vm.yaml @@ -36,6 +36,7 @@ {{- fail (printf "routeTable %q needs the VM to join a VPC: name the VirtualPrivateCloud in networks" $routeTable) }} {{- end }} {{- end }} +{{- $gpus := include "cozy-lib.gpu.entries" (list .Values.gpus .Values._cluster) | fromJson }} apiVersion: kubevirt.io/v1 kind: VirtualMachine @@ -80,8 +81,14 @@ spec: sdn.cozystack.io/route-table: {{ . | quote }} {{- end }} {{- end }} + {{- with $gpus.classes }} + cozystack.io/gpus: {{ toJson . | quote }} + {{- end }} labels: {{- include "virtual-machine.labels" . | nindent 8 }} + {{- if $gpus.classes }} + cozystack.io/gpu-reference: "true" + {{- end }} spec: domain: {{- $domainRes := include "virtual-machine.domainResources" . | fromJson -}} @@ -109,11 +116,11 @@ spec: enabled: true {{- end }} devices: - {{- if .Values.gpus }} + {{- with $gpus.names }} gpus: - {{- range $i, $gpu := .Values.gpus }} + {{- range $i, $name := . }} - name: gpu{{ add $i 1 }} - deviceName: {{ $gpu.name }} + deviceName: {{ $name }} {{- end }} {{- end }} disks: diff --git a/packages/apps/vm-instance/tests/gpus_test.yaml b/packages/apps/vm-instance/tests/gpus_test.yaml new file mode 100644 index 000000000..3e77fc33e --- /dev/null +++ b/packages/apps/vm-instance/tests/gpus_test.yaml @@ -0,0 +1,155 @@ +suite: vm-instance gpus + +templates: + - templates/vm.yaml +release: + name: test-vm + namespace: tenant-test +set: + fullnameOverride: test-vm + _cluster: + gpu-vm-enabled: "true" + instanceType: "" + instanceProfile: "" + resources: + cpu: 2 + sockets: 1 + memory: 8Gi +tests: + - it: renders name entries as gpus + set: + gpus: + - name: nvidia.com/GA102GL_A10 + - name: nvidia.com/GA102GL_A10 + asserts: + - equal: + path: spec.template.spec.domain.devices.gpus + value: + - name: gpu1 + deviceName: nvidia.com/GA102GL_A10 + - name: gpu2 + deviceName: nvidia.com/GA102GL_A10 + - notExists: + path: spec.template.metadata.labels["cozystack.io/gpu-reference"] + - notExists: + path: spec.template.metadata.annotations["cozystack.io/gpus"] + + - it: renders class entries as the annotation and the reference label only + set: + gpus: + - className: h100 + count: 2 + - className: a100 + asserts: + - equal: + path: spec.template.metadata.annotations["cozystack.io/gpus"] + value: '[{"className":"h100","count":2},{"className":"a100","count":1}]' + - equal: + path: spec.template.metadata.labels["cozystack.io/gpu-reference"] + value: "true" + - notExists: + path: spec.template.spec.domain.devices.gpus + + # A typed client sends the zero value of every field. + - it: reads a zero count and an empty name as unset + set: + gpus: + - className: h100 + name: "" + count: 0 + asserts: + - equal: + path: spec.template.metadata.annotations["cozystack.io/gpus"] + value: '[{"className":"h100","count":1}]' + + - it: renders no gpus without entries + asserts: + - notExists: + path: spec.template.spec.domain.devices.gpus + - notExists: + path: spec.template.metadata.labels["cozystack.io/gpu-reference"] + + - it: refuses an entry with both name and className + set: + gpus: + - name: nvidia.com/GA102GL_A10 + className: a10 + asserts: + - failedTemplate: + errorPattern: "gpus\\[0\\]: set exactly one of name and className" + + - it: refuses an entry with neither + set: + gpus: + - count: 1 + asserts: + - failedTemplate: + errorPattern: "gpus\\[0\\]: set exactly one of name and className" + + - it: refuses count on a name entry + set: + gpus: + - name: nvidia.com/GA102GL_A10 + count: 2 + asserts: + - failedTemplate: + errorPattern: "gpus\\[0\\]: count applies to className entries only" + + - it: refuses a count below one + set: + gpus: + - className: h100 + count: -1 + asserts: + - failedTemplate: + errorPattern: "gpus\\[0\\].count must be a whole number of at least 1" + + - it: refuses a mixed list + set: + gpus: + - name: nvidia.com/GA102GL_A10 + - className: h100 + asserts: + - failedTemplate: + errorPattern: "gpus: list either only name entries or only className entries" + + - it: refuses class entries where GPUs do not serve VMs + set: + _cluster: + gpu-vm-enabled: "false" + gpus: + - className: h100 + asserts: + - failedTemplate: + errorPattern: "gpus: className entries need GPUs for VMs" + + - it: keeps name entries where GPUs do not serve VMs + set: + _cluster: + gpu-vm-enabled: "false" + gpus: + - name: nvidia.com/GA102GL_A10 + asserts: + - equal: + path: spec.template.spec.domain.devices.gpus[0].deviceName + value: nvidia.com/GA102GL_A10 + + - it: refuses more GPU entries than the admission expansion limit + set: + gpus: + - className: h100 + count: 1025 + asserts: + - failedTemplate: + errorPattern: "at most 1024 GPU units" + + - it: applies the admission expansion limit across class entries + set: + gpus: + - className: h100 + count: 600 + - className: a100 + count: 600 + asserts: + - failedTemplate: + errorPattern: "at most 1024 GPU units" diff --git a/packages/apps/vm-instance/values.schema.json b/packages/apps/vm-instance/values.schema.json index 2ab3da028..fac1f2dd1 100644 --- a/packages/apps/vm-instance/values.schema.json +++ b/packages/apps/vm-instance/values.schema.json @@ -135,12 +135,20 @@ "default": [], "items": { "type": "object", - "required": [ - "name" - ], "properties": { + "className": { + "description": "GPUClass to take GPUs of.", + "type": "string", + "x-cozystack-options": { + "source": "gpuclass" + } + }, + "count": { + "description": "GPUs of the class; 1 when unset.", + "type": "integer" + }, "name": { - "description": "The name of the GPU resource to attach.", + "description": "Resource name of the GPU to request directly.", "type": "string", "x-cozystack-options": { "source": "gpu" diff --git a/packages/apps/vm-instance/values.yaml b/packages/apps/vm-instance/values.yaml index 043f454c8..a166d4a6a 100644 --- a/packages/apps/vm-instance/values.yaml +++ b/packages/apps/vm-instance/values.yaml @@ -17,9 +17,12 @@ ## @field {string} [name] - Network attachment name. ## @x-cozystack-options {source: network} -## @typedef {struct} GPU - GPU device configuration. -## @field {string} name - The name of the GPU resource to attach. +## @typedef {struct} GPU - GPU configuration. Set exactly one of name and className; a list holds either only name entries or only className entries. +## @field {string} [name] - Resource name of the GPU to request directly. ## @x-cozystack-options {source: gpu} +## @field {string} [className] - GPUClass to take GPUs of. +## @x-cozystack-options {source: gpuclass} +## @field {int} [count] - GPUs of the class; 1 when unset. ## @typedef {struct} Resources - Resource configuration for the virtual machine. ## @field {quantity} [cpu] - Number of CPU cores allocated, as a positive whole number such as `2`. Millicore or other unit-suffixed, fractional, zero, negative, above 4294967295 and quoted leading-zero values are rejected at render time, because the value becomes the VM's unsigned integer `domain.cpu.cores`. @@ -95,7 +98,8 @@ routeTable: "" gpus: [] ## Example: ## gpus: -## - name: nvidia.com/GA102GL_A10 +## - className: l40s-24c +## count: 1 ## @param {string} cpuModel - Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map cpuModel: "" diff --git a/packages/library/cozy-lib/templates/_gpu.tpl b/packages/library/cozy-lib/templates/_gpu.tpl new file mode 100644 index 000000000..b0a61f47d --- /dev/null +++ b/packages/library/cozy-lib/templates/_gpu.tpl @@ -0,0 +1,51 @@ +{{/* +cozy-lib.gpu.entries reads a gpus list of name and className entries and +returns, as JSON, {"names": [...], "classes": [{className, count}]}. An entry +sets exactly one of name and className, count goes with className only and +defaults to 1, and a list holds one kind. Class entries fail without +_cluster.gpu-vm-enabled, since no webhook would resolve them and the VM would +boot without its GPUs. A typed client sends the zero value of every field, so +an empty string and a count of 0 read as unset. + + {{- $gpus := include "cozy-lib.gpu.entries" (list .Values.gpus .Values._cluster) | fromJson }} +*/}} +{{- define "cozy-lib.gpu.entries" -}} +{{- $gpus := index . 0 | default list -}} +{{- $cluster := index . 1 | default dict -}} +{{- $names := list -}} +{{- $classes := list -}} +{{- $units := 0 -}} +{{- range $i, $gpu := $gpus -}} +{{- $name := $gpu.name | default "" | toString -}} +{{- $class := $gpu.className | default "" | toString -}} +{{- if eq (empty $name) (empty $class) -}} +{{- fail (printf "gpus[%d]: set exactly one of name and className" $i) -}} +{{- end -}} +{{- $count := "1" -}} +{{- if not (empty $gpu.count) -}} +{{- if $name -}} +{{- fail (printf "gpus[%d]: count applies to className entries only" $i) -}} +{{- end -}} +{{- $count = printf "%v" $gpu.count -}} +{{- end -}} +{{- if not (regexMatch "^[1-9][0-9]{0,8}$" $count) -}} +{{- fail (printf "gpus[%d].count must be a whole number of at least 1" $i) -}} +{{- end -}} +{{- if $name -}} +{{- $names = append $names $name -}} +{{- else -}} +{{- $units = add $units ($count | atoi) -}} +{{- if gt $units 1024 -}} +{{- fail "a VMI can expand at most 1024 GPU units from class entries" -}} +{{- end -}} +{{- $classes = append $classes (dict "className" $class "count" ($count | atoi)) -}} +{{- end -}} +{{- end -}} +{{- if and $names $classes -}} +{{- fail "gpus: list either only name entries or only className entries" -}} +{{- end -}} +{{- if and $classes (ne (toString (index $cluster "gpu-vm-enabled" | default "false")) "true") -}} +{{- fail "gpus: className entries need GPUs for VMs, which this cluster does not serve; use name entries or ask the hoster to enable GPUs" -}} +{{- end -}} +{{- dict "names" $names "classes" $classes | toJson -}} +{{- end -}} diff --git a/packages/system/vm-instance-rd/cozyrds/vm-instance.yaml b/packages/system/vm-instance-rd/cozyrds/vm-instance.yaml index 439d712d8..2df76f388 100644 --- a/packages/system/vm-instance-rd/cozyrds/vm-instance.yaml +++ b/packages/system/vm-instance-rd/cozyrds/vm-instance.yaml @@ -12,7 +12,7 @@ spec: singular: vminstance plural: vminstances openAPISchema: |- - {"title":"Chart Values","type":"object","properties":{"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"externalMethod":{"description":"Method to pass through traffic to the VM.","type":"string","default":"PortList","enum":["PortList","WholeIP"]},"externalPorts":{"description":"Ports to forward from outside the cluster.","type":"array","default":[22],"items":{"type":"integer"}},"externalAllowICMP":{"description":"Whether to accept ICMP traffic to the VM in PortList mode (preserves ping and PMTU discovery). No effect in WholeIP mode. Default true so ping behaves as users expect even when port filtering is in effect.","type":"boolean","default":true},"runStrategy":{"description":"Requested running state of the VirtualMachineInstance","type":"string","default":"Always","enum":["Always","Halted","Manual","RerunOnFailure","Once"]},"instanceType":{"description":"Virtual Machine instance type. Ignored when `resources` sizes the VM, which needs whole-number cpu and sockets plus memory; the whole type is dropped then, so any dedicated CPU placement, hugepages, NUMA or realtime settings it carries go with it. While this field is set, a `resources` block that sizes only part of the VM is rejected outright instead of ignored, so complete it or clear it.","type":"string","default":"u1.medium","x-cozystack-options":{"source":"instancetype"}},"instanceProfile":{"description":"Virtual Machine preferences profile.","type":"string","default":"ubuntu","x-cozystack-options":{"source":"instanceprofile"}},"disks":{"description":"List of disks to attach.","type":"array","default":[],"items":{"type":"object","required":["name"],"properties":{"bootOrder":{"description":"Boot priority of the disk, 1 being tried first. Unset falls back to the disk's position in `disks` (the first disk gets 1), so set it to boot from a disk other than the first, such as an attached installer or rescue ISO, without reordering the list. Effective boot orders must be unique across disks: when one disk is given a value that another takes from its position, set both.","type":"integer","minimum":1},"bus":{"description":"Disk bus type (e.g. \"sata\").","type":"string"},"name":{"description":"Disk name.","type":"string","x-cozystack-options":{"source":"vmdisk"}}}}},"networks":{"description":"Networks to attach the VM to. On the cozyplane networking variant the single entry names the VirtualPrivateCloud the VM joins (at most one; the VM keeps its one pod interface).","type":"array","default":[],"items":{"type":"object","properties":{"name":{"description":"Network attachment name.","type":"string","x-cozystack-options":{"source":"network"}}}}},"subnets":{"description":"Deprecated: use networks instead.","type":"array","default":[],"items":{"type":"object","properties":{"name":{"description":"Network attachment name.","type":"string","x-cozystack-options":{"source":"network"}}}}},"routeTable":{"description":"Name of a cozyplane RouteTable in the VM's namespace that routes the VM's traffic. Empty uses the VPC's default table. Requires the cozyplane networking variant and a VPC in `networks`.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"gpus":{"description":"List of GPUs to attach (NVIDIA driver requires at least 4 GiB RAM).","type":"array","default":[],"items":{"type":"object","required":["name"],"properties":{"name":{"description":"The name of the GPU resource to attach.","type":"string","x-cozystack-options":{"source":"gpu"}}}}},"cpuModel":{"description":"Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map","type":"string","default":""},"firmware":{"description":"Firmware and boot configuration (UEFI/BIOS selection, Secure Boot, persistent EFI NVRAM).","type":"object","default":{},"properties":{"bootloader":{"description":"Bootloader to boot the VM with: \"uefi\" (OVMF) or \"bios\" (SeaBIOS). Empty inherits the instanceProfile default.","type":"string"},"efiPersistent":{"description":"Persist EFI NVRAM (e.g. enrolled Secure Boot keys, such as an updated Microsoft UEFI CA) across reboots. Only applies when bootloader is \"uefi\".","type":"boolean"},"secureBoot":{"description":"Enable UEFI Secure Boot. Only applies when bootloader is \"uefi\".","type":"boolean"}}},"resources":{"description":"Resource configuration for the virtual machine. Set whole-number cpu and sockets together with memory to size the VM directly, which overrides `instanceType`. Alongside an `instanceType`, a block that sizes only part of the VM is rejected; a whole-number cpu or sockets on its own sizes nothing and is ignored.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated, as a positive whole number such as `2`. Millicore or other unit-suffixed, fractional, zero, negative, above 4294967295 and quoted leading-zero values are rejected at render time, because the value becomes the VM's unsigned integer `domain.cpu.cores`.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated, as a quantity of at least `1M` such as `8Gi`. Less than 1M is rejected at render time, because KubeVirt refuses a non-zero amount below 1M and a zero or negative amount sizes nothing.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"sockets":{"description":"Number of CPU sockets (vCPU topology), as a positive whole number such as `1`. Millicore or other unit-suffixed, fractional, zero, negative, above 4294967295 and quoted leading-zero values are rejected at render time, because the value becomes the VM's unsigned integer `domain.cpu.sockets`.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"sshKeys":{"description":"List of SSH public keys for authentication.","type":"array","default":[],"items":{"type":"string"}},"cloudInit":{"description":"Cloud-init user data.","type":"string","default":""},"netplanDhcp":{"description":"Supply cloud-init network-data that requests DHCP on every `en*` and `eth*` interface and keeps the DNS search domains DHCP offers. Needed for a netplan guest (Ubuntu, Debian) to address a secondary network such as a VPC subnet. Leave it off for a guest rendered by anything other than netplan, which would lose DHCP on every interface, and for a guest that configures an interface statically through netplan, which this configuration would shadow. Turning it on for a VM that has neither `cloudInit` nor `sshKeys` adds a cloud-init disk, and the guest's next boot is then treated as a first boot.","type":"boolean","default":false},"cloudInitSeed":{"description":"Seed string to generate SMBIOS UUID for the VM.","type":"string","default":""},"schedulingClass":{"description":"Name of a SchedulingClass CR (cluster-scoped, group cozystack.io) used in place of the tenant's for this application's pods. A pod gets its class when it is created, so running pods keep theirs until they are recreated. Must be the tenant's own class or one listed in the tenant's `allowedSchedulingClasses`. Setting any other value is refused, and the pods of an application whose class is not, or no longer, in that list get the tenant's class. Empty means inherit from the tenant.","type":"string","default":"","maxLength":63}}} + {"title":"Chart Values","type":"object","properties":{"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"externalMethod":{"description":"Method to pass through traffic to the VM.","type":"string","default":"PortList","enum":["PortList","WholeIP"]},"externalPorts":{"description":"Ports to forward from outside the cluster.","type":"array","default":[22],"items":{"type":"integer"}},"externalAllowICMP":{"description":"Whether to accept ICMP traffic to the VM in PortList mode (preserves ping and PMTU discovery). No effect in WholeIP mode. Default true so ping behaves as users expect even when port filtering is in effect.","type":"boolean","default":true},"runStrategy":{"description":"Requested running state of the VirtualMachineInstance","type":"string","default":"Always","enum":["Always","Halted","Manual","RerunOnFailure","Once"]},"instanceType":{"description":"Virtual Machine instance type. Ignored when `resources` sizes the VM, which needs whole-number cpu and sockets plus memory; the whole type is dropped then, so any dedicated CPU placement, hugepages, NUMA or realtime settings it carries go with it. While this field is set, a `resources` block that sizes only part of the VM is rejected outright instead of ignored, so complete it or clear it.","type":"string","default":"u1.medium","x-cozystack-options":{"source":"instancetype"}},"instanceProfile":{"description":"Virtual Machine preferences profile.","type":"string","default":"ubuntu","x-cozystack-options":{"source":"instanceprofile"}},"disks":{"description":"List of disks to attach.","type":"array","default":[],"items":{"type":"object","required":["name"],"properties":{"bootOrder":{"description":"Boot priority of the disk, 1 being tried first. Unset falls back to the disk's position in `disks` (the first disk gets 1), so set it to boot from a disk other than the first, such as an attached installer or rescue ISO, without reordering the list. Effective boot orders must be unique across disks: when one disk is given a value that another takes from its position, set both.","type":"integer","minimum":1},"bus":{"description":"Disk bus type (e.g. \"sata\").","type":"string"},"name":{"description":"Disk name.","type":"string","x-cozystack-options":{"source":"vmdisk"}}}}},"networks":{"description":"Networks to attach the VM to. On the cozyplane networking variant the single entry names the VirtualPrivateCloud the VM joins (at most one; the VM keeps its one pod interface).","type":"array","default":[],"items":{"type":"object","properties":{"name":{"description":"Network attachment name.","type":"string","x-cozystack-options":{"source":"network"}}}}},"subnets":{"description":"Deprecated: use networks instead.","type":"array","default":[],"items":{"type":"object","properties":{"name":{"description":"Network attachment name.","type":"string","x-cozystack-options":{"source":"network"}}}}},"routeTable":{"description":"Name of a cozyplane RouteTable in the VM's namespace that routes the VM's traffic. Empty uses the VPC's default table. Requires the cozyplane networking variant and a VPC in `networks`.","type":"string","default":"","maxLength":253,"pattern":"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"},"gpus":{"description":"List of GPUs to attach (NVIDIA driver requires at least 4 GiB RAM).","type":"array","default":[],"items":{"type":"object","properties":{"className":{"description":"GPUClass to take GPUs of.","type":"string","x-cozystack-options":{"source":"gpuclass"}},"count":{"description":"GPUs of the class; 1 when unset.","type":"integer"},"name":{"description":"Resource name of the GPU to request directly.","type":"string","x-cozystack-options":{"source":"gpu"}}}}},"cpuModel":{"description":"Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map","type":"string","default":""},"firmware":{"description":"Firmware and boot configuration (UEFI/BIOS selection, Secure Boot, persistent EFI NVRAM).","type":"object","default":{},"properties":{"bootloader":{"description":"Bootloader to boot the VM with: \"uefi\" (OVMF) or \"bios\" (SeaBIOS). Empty inherits the instanceProfile default.","type":"string"},"efiPersistent":{"description":"Persist EFI NVRAM (e.g. enrolled Secure Boot keys, such as an updated Microsoft UEFI CA) across reboots. Only applies when bootloader is \"uefi\".","type":"boolean"},"secureBoot":{"description":"Enable UEFI Secure Boot. Only applies when bootloader is \"uefi\".","type":"boolean"}}},"resources":{"description":"Resource configuration for the virtual machine. Set whole-number cpu and sockets together with memory to size the VM directly, which overrides `instanceType`. Alongside an `instanceType`, a block that sizes only part of the VM is rejected; a whole-number cpu or sockets on its own sizes nothing and is ignored.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated, as a positive whole number such as `2`. Millicore or other unit-suffixed, fractional, zero, negative, above 4294967295 and quoted leading-zero values are rejected at render time, because the value becomes the VM's unsigned integer `domain.cpu.cores`.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated, as a quantity of at least `1M` such as `8Gi`. Less than 1M is rejected at render time, because KubeVirt refuses a non-zero amount below 1M and a zero or negative amount sizes nothing.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"sockets":{"description":"Number of CPU sockets (vCPU topology), as a positive whole number such as `1`. Millicore or other unit-suffixed, fractional, zero, negative, above 4294967295 and quoted leading-zero values are rejected at render time, because the value becomes the VM's unsigned integer `domain.cpu.sockets`.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"sshKeys":{"description":"List of SSH public keys for authentication.","type":"array","default":[],"items":{"type":"string"}},"cloudInit":{"description":"Cloud-init user data.","type":"string","default":""},"netplanDhcp":{"description":"Supply cloud-init network-data that requests DHCP on every `en*` and `eth*` interface and keeps the DNS search domains DHCP offers. Needed for a netplan guest (Ubuntu, Debian) to address a secondary network such as a VPC subnet. Leave it off for a guest rendered by anything other than netplan, which would lose DHCP on every interface, and for a guest that configures an interface statically through netplan, which this configuration would shadow. Turning it on for a VM that has neither `cloudInit` nor `sshKeys` adds a cloud-init disk, and the guest's next boot is then treated as a first boot.","type":"boolean","default":false},"cloudInitSeed":{"description":"Seed string to generate SMBIOS UUID for the VM.","type":"string","default":""},"schedulingClass":{"description":"Name of a SchedulingClass CR (cluster-scoped, group cozystack.io) used in place of the tenant's for this application's pods. A pod gets its class when it is created, so running pods keep theirs until they are recreated. Must be the tenant's own class or one listed in the tenant's `allowedSchedulingClasses`. Setting any other value is refused, and the pods of an application whose class is not, or no longer, in that list get the tenant's class. Empty means inherit from the tenant.","type":"string","default":"","maxLength":63}}} release: prefix: vm-instance- labels: