feat(platform): enable the GPU class controllers with VM GPUs

GPUClass status and license copies matter only where gpu-operator
hands GPUs to VirtualMachines, which is its default and vgpu
variants in the iaas bundle. The platform now passes gpu.enabled to
cozystack-controller there, so a hoster enabling VM GPUs gets the
class controllers without editing the generated Package, and a
cluster on the container variant or without gpu-operator keeps them
off.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
Aleksei Sviridkin committed 2026-11-28 09:25:34 +03:00
1 parent fe4138a09e
commit e8e7bce8cc
3 files changed
+136

No files matched your search

@@ -448,3 +448,18 @@ sliced into /24s ever allowed.
{{- end -}}
{{- end -}}
{{- end }}
{{/*
Prints "true" when gpu-operator serves GPUs to VirtualMachines: the iaas
bundle emits it and its variant is default or vgpu. The container variant
serves GPUs to pods only, which no GPUClass describes.
*/}}
{{- define "cozystack.platform.gpu.vmEnabled" -}}
{{- $name := "cozystack.gpu-operator" -}}
{{- $bundles := .Values.bundles -}}
{{- $iaas := and $bundles.system.enabled $bundles.iaas.enabled (has $bundles.system.variant (list "isp-full" "isp-full-generic")) -}}
{{- $enabled := and $iaas (has $name (default (list) $bundles.enabledPackages)) (not (has $name (default (list) $bundles.disabledPackages))) -}}
{{- if and $enabled (has ($bundles.iaas.gpuOperatorVariant | default "default") (list "default" "vgpu")) -}}
true
{{- end -}}
{{- end }}
@@ -256,6 +256,9 @@
{{- if .Values.telemetry.disabled -}}
{{- $_ := set $controllerValues "disableTelemetry" true -}}
{{- end -}}
{{- if eq (include "cozystack.platform.gpu.vmEnabled" $) "true" -}}
{{- $_ := set $controllerValues "gpu" (dict "enabled" true) -}}
{{- end -}}
{{- /* EndpointAttachment's method: WholeIP|PortList modes render the Service
contract cozy-proxy implements. A proxy skips a Service delegated to a
name it does not claim while the load balancer still attracts the
@@ -0,0 +1,118 @@
suite: GPU controllers follow gpu-operator's VM variants
templates:
- templates/bundles/system.yaml
release:
name: cozystack
namespace: cozy-system
tests:
- it: enables the GPU controllers when gpu-operator serves GPUs to VMs
set:
bundles:
system:
enabled: true
variant: isp-full
iaas:
enabled: true
gpuOperatorVariant: vgpu
enabledPackages:
- cozystack.gpu-operator
telemetry:
disabled: true
documentSelector:
path: metadata.name
value: cozystack.cozystack-engine
asserts:
- equal:
path: spec.components.cozystack-controller.values.cozystackController
value:
disableTelemetry: true
endpointAttachments:
allocateLoadBalancerNodePorts: false
cozyProxyContractImplemented: true
gpu:
enabled: true
- it: enables them for the default variant on isp-full-generic
set:
bundles:
system:
enabled: true
variant: isp-full-generic
iaas:
enabled: true
enabledPackages:
- cozystack.gpu-operator
documentSelector:
path: metadata.name
value: cozystack.cozystack-engine
asserts:
- equal:
path: spec.components.cozystack-controller.values.cozystackController.gpu.enabled
value: true
- it: leaves them off for the container variant
set:
bundles:
system:
enabled: true
variant: isp-full
iaas:
enabled: true
gpuOperatorVariant: container
enabledPackages:
- cozystack.gpu-operator
documentSelector:
path: metadata.name
value: cozystack.cozystack-engine
asserts:
- notExists:
path: spec.components.cozystack-controller.values.cozystackController.gpu
- it: leaves them off when gpu-operator is disabled
set:
bundles:
system:
enabled: true
variant: isp-full
iaas:
enabled: true
enabledPackages:
- cozystack.gpu-operator
disabledPackages:
- cozystack.gpu-operator
documentSelector:
path: metadata.name
value: cozystack.cozystack-engine
asserts:
- notExists:
path: spec.components.cozystack-controller.values.cozystackController.gpu
- it: leaves them off without the iaas bundle
set:
bundles:
system:
enabled: true
variant: isp-full
enabledPackages:
- cozystack.gpu-operator
documentSelector:
path: metadata.name
value: cozystack.cozystack-engine
asserts:
- notExists:
path: spec.components.cozystack-controller.values.cozystackController.gpu
- it: leaves them off on an iaas cluster without gpu-operator
set:
bundles:
system:
enabled: true
variant: isp-full
iaas:
enabled: true
documentSelector:
path: metadata.name
value: cozystack.cozystack-engine
asserts:
- notExists:
path: spec.components.cozystack-controller.values.cozystackController.gpu