Skip to content

Commit a60c2e6

Browse files
committed
fix(gpu-operator): name kernel-module ConfigMap after the driver reference
The wrapper chart named the kernel-module ConfigMap from its own kernelModuleConfig.name key, while the NVIDIA driver mounts the ConfigMap referenced by gpu-operator.driver.kernelModuleConfig.name. The two keys defaulted to the same value but were never linked, so overriding only the driver reference left the driver pointing at a ConfigMap that is never rendered and the NVreg_NvLinkDisable=1 parameters were silently dropped. Derive the ConfigMap name from the driver's effective reference, falling back to the wrapper key when unset, so the rendered ConfigMap and the driver reference can no longer diverge. Add helm-unittest coverage for the rendered name, namespace, data key, and the create=false no-op. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 238a3b6 commit a60c2e6

2 files changed

Lines changed: 61 additions & 1 deletion

File tree

‎packages/system/gpu-operator/templates/kernel-module-config.yaml‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
{{- if .Values.kernelModuleConfig.create }}
2+
{{- /*
3+
Name the ConfigMap after the driver's effective kernelModuleConfig
4+
reference (gpu-operator.driver.kernelModuleConfig.name) — that is the
5+
name the operator mounts into the driver pod. Falling back to the
6+
wrapper's own kernelModuleConfig.name keeps the two from ever diverging:
7+
overriding only the driver reference would otherwise leave the driver
8+
pointing at a ConfigMap that is never rendered.
9+
*/}}
10+
{{- $gpuOperator := index .Values "gpu-operator" | default dict -}}
11+
{{- $driver := index $gpuOperator "driver" | default dict -}}
12+
{{- $driverKmc := index $driver "kernelModuleConfig" | default dict -}}
13+
{{- $name := $driverKmc.name | default .Values.kernelModuleConfig.name -}}
214
apiVersion: v1
315
kind: ConfigMap
416
metadata:
5-
name: {{ .Values.kernelModuleConfig.name }}
17+
name: {{ $name }}
618
namespace: {{ .Release.Namespace }}
719
labels:
820
app.kubernetes.io/managed-by: {{ .Release.Service }}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
suite: GPU operator kernel module ConfigMap tests
2+
3+
templates:
4+
- templates/kernel-module-config.yaml
5+
6+
tests:
7+
- it: does not render the ConfigMap when create is false (default)
8+
asserts:
9+
- hasDocuments:
10+
count: 0
11+
12+
- it: renders the ConfigMap into the release namespace with the nvidia.conf key when create is true
13+
release:
14+
name: gpu-operator
15+
namespace: cozy-gpu-operator
16+
set:
17+
kernelModuleConfig:
18+
create: true
19+
asserts:
20+
- hasDocuments:
21+
count: 1
22+
- isKind:
23+
of: ConfigMap
24+
- equal:
25+
path: metadata.name
26+
value: nvidia-kernel-module-params
27+
- equal:
28+
path: metadata.namespace
29+
value: cozy-gpu-operator
30+
- matchRegex:
31+
path: data["nvidia.conf"]
32+
pattern: NVreg_NvLinkDisable=1
33+
34+
- it: names the ConfigMap after the driver kernelModuleConfig reference so the two cannot diverge
35+
release:
36+
name: gpu-operator
37+
namespace: cozy-gpu-operator
38+
set:
39+
kernelModuleConfig:
40+
create: true
41+
gpu-operator:
42+
driver:
43+
kernelModuleConfig:
44+
name: my-custom-kmc
45+
asserts:
46+
- equal:
47+
path: metadata.name
48+
value: my-custom-kmc

0 commit comments

Comments
 (0)