Files
cozystack/packages/apps/kubernetes/tests/gpu_operator_hami_test.yaml
T
Mattia Eleuteri 669fb2416a feat(kubernetes): default gpu-operator to an OS-provided driver on Talos
Closes the gpu-operator half of #3563. Tenant clusters have run Talos
workers since 1.6.0, where the NVIDIA driver comes from a system extension
baked into the worker image rather than from the operator's driver
container. The addon default still described the Ubuntu shape, so a GPU
node group came up with the operator fighting the OS for the driver and no
path at all for CUDA libraries to reach a tenant pod.

Three things change, each fixing one silent failure:

driver.enabled and toolkit.enabled go false. The driver container would
load its own module and clash with the extension's; the toolkit container
would rewrite /etc/containerd/config.toml, which Talos owns and which
already registers the nvidia runtime with enable_cdi = true and
cdi_spec_dirs = ['/run/cdi'].

validator.driver.env points DRIVER_ROOT and NVIDIA_DRIVER_ROOT at / and
disables /dev/char symlink creation. The driver validator otherwise looks
for a driver container install, finds none, never writes its sentinel, and
leaves the device plugin blocked behind toolkit-validation — the loop on
"Attempting to validate a driver container installation".

devicePlugin.env selects cdi-annotations and points NVIDIA_CTK_PATH at the
host's nvidia-ctk. Tenant pods carry no runtimeClassName and did not need
one on Ubuntu, where the toolkit made nvidia the default containerd
runtime; Talos does not, so CDI is the only route for the CUDA libraries.
DEVICE_ID_STRATEGY, NVIDIA_DRIVER_ROOT and CDI_ANNOTATION_PREFIX are set
and tested alongside it: CDI device names key on the UUID strategy, the
plugin resolves the driver from NVIDIA_DRIVER_ROOT, and the annotation
prefix has to be the one containerd reads, so a regression in any of them
breaks device resolution on its own.

The previous default fed NVreg_NvLinkDisable=1 to the driver container
through the nvidia-kernel-module-params ConfigMap. With that container off
the ConfigMap is mounted by nothing, so the default is removed. On Talos a
module parameter belongs to the worker machine config, which the
kernelModules field of the KubernetesNodes app
(packages/apps/kubernetes-nodes, #3571) writes. The wrapper chart keeps
the ConfigMap for an operator who re-enables the driver container.

Every value here is the configuration validated on a production Talos GPU
node group, minus the parts that only mattered while the driver container
was in play.

Not covered: HAMi. When addons.hami.enabled the operator's device plugin
stays off and HAMi serves the GPUs, and HAMi's own plugin needs equivalent
CDI wiring on Talos that this default does not attempt.

Refs: #3563

Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
2026-09-29 17:09:13 +02:00

198 lines
5.9 KiB
YAML

suite: GPU Operator HelmRelease HAMi integration tests
templates:
- templates/helmreleases/gpu-operator.yaml
values:
- values-ci.yaml
tests:
- it: should disable devicePlugin when hami is enabled
set:
addons:
gpuOperator:
enabled: true
valuesOverride: {}
hami:
enabled: true
valuesOverride: {}
asserts:
- equal:
path: spec.values.gpu-operator.devicePlugin.enabled
value: false
# On Talos the driver comes from a system extension: the operator must not own
# the driver or containerd, the validator must look at the host root, and the
# device plugin must route CUDA libraries through CDI.
- it: configures the operator for a driver provided by the OS
set:
addons:
gpuOperator:
enabled: true
valuesOverride: {}
hami:
enabled: false
valuesOverride: {}
asserts:
- equal:
path: spec.values.gpu-operator.driver.enabled
value: false
- equal:
path: spec.values.gpu-operator.toolkit.enabled
value: false
# Without these the validator never writes its sentinel and the device
# plugin stays blocked behind toolkit-validation.
- contains:
path: spec.values.gpu-operator.validator.driver.env
content:
name: DRIVER_ROOT
value: "/"
- contains:
path: spec.values.gpu-operator.validator.driver.env
content:
name: DISABLE_DEV_CHAR_SYMLINK_CREATION
value: "true"
# Without the CDI settings the pod gets the device and no CUDA libraries.
- contains:
path: spec.values.gpu-operator.devicePlugin.env
content:
name: DEVICE_LIST_STRATEGY
value: cdi-annotations
- contains:
path: spec.values.gpu-operator.devicePlugin.env
content:
name: NVIDIA_CTK_PATH
value: /usr/local/bin/nvidia-ctk
# CDI device names key on the UUID strategy, the plugin resolves the driver
# from NVIDIA_DRIVER_ROOT, and the annotation prefix has to be the one
# containerd reads.
- contains:
path: spec.values.gpu-operator.devicePlugin.env
content:
name: DEVICE_ID_STRATEGY
value: uuid
- contains:
path: spec.values.gpu-operator.devicePlugin.env
content:
name: NVIDIA_DRIVER_ROOT
value: "/"
- contains:
path: spec.values.gpu-operator.devicePlugin.env
content:
name: CDI_ANNOTATION_PREFIX
value: cdi.k8s.io/
# The driver-validation init container reads NVIDIA_DRIVER_ROOT alongside
# DRIVER_ROOT.
- contains:
path: spec.values.gpu-operator.validator.driver.env
content:
name: NVIDIA_DRIVER_ROOT
value: "/"
# With the driver container off nothing mounts this ConfigMap. Module
# parameters belong to the worker pool's kernelModules in the KubernetesNodes
# app (packages/apps/kubernetes-nodes), and an inert second place to set them
# would only mislead.
- it: does not render the driver-container kernel module ConfigMap
set:
addons:
gpuOperator:
enabled: true
valuesOverride: {}
hami:
enabled: false
valuesOverride: {}
asserts:
- notExists:
path: spec.values.kernelModuleConfig
- notExists:
path: spec.values.gpu-operator.driver.kernelModuleConfig
# mergeOverwrite replaces a list rather than merging it, so an override adding
# one variable to devicePlugin.env drops the CDI defaults with it and has to
# restate the full list.
- it: lets an operator replace the device plugin env wholesale
set:
addons:
gpuOperator:
enabled: true
valuesOverride:
gpu-operator:
devicePlugin:
env:
- name: DEVICE_LIST_STRATEGY
value: envvar
hami:
enabled: false
valuesOverride: {}
asserts:
- equal:
path: spec.values.gpu-operator.devicePlugin.env
value:
- name: DEVICE_LIST_STRATEGY
value: envvar
- it: should apply hami defaults when valuesOverride key is omitted
set:
addons:
gpuOperator:
enabled: true
hami:
enabled: true
asserts:
- equal:
path: spec.values.gpu-operator.devicePlugin.enabled
value: false
- it: should allow user overrides to merge with hami defaults
set:
addons:
gpuOperator:
enabled: true
valuesOverride:
gpu-operator:
driver:
enabled: false
hami:
enabled: true
valuesOverride: {}
asserts:
- equal:
path: spec.values.gpu-operator.devicePlugin.enabled
value: false
- equal:
path: spec.values.gpu-operator.driver.enabled
value: false
- it: should let user explicitly override devicePlugin.enabled to true with hami enabled
set:
addons:
gpuOperator:
enabled: true
valuesOverride:
gpu-operator:
devicePlugin:
enabled: true
driver:
enabled: false
hami:
enabled: true
valuesOverride: {}
asserts:
- equal:
path: spec.values.gpu-operator.devicePlugin.enabled
value: true
- equal:
path: spec.values.gpu-operator.driver.enabled
value: false
- it: should not render when gpuOperator is disabled
set:
addons:
gpuOperator:
enabled: false
valuesOverride: {}
hami:
enabled: false
valuesOverride: {}
asserts:
- hasDocuments:
count: 0