|
1 | 1 | #!/usr/bin/env bats |
2 | 2 | # ----------------------------------------------------------------------------- |
3 | | -# Catches silent regressions in the gpu-operator package's two variants: |
| 3 | +# Catches silent regressions in the gpu-operator package's three variants: |
4 | 4 | # |
5 | 5 | # 1. The base values.yaml pins ccManager.enabled=false and |
6 | 6 | # vgpuDeviceManager.enabled=false. Both upstream defaults are now true |
7 | 7 | # (chart v26.x). If the next chart bump silently un-pins either one, |
8 | 8 | # the `default` (passthrough) variant would gain confidential-computing |
9 | 9 | # auto-enable on Hopper hardware (ccManager) or render an mdev DaemonSet |
10 | | -# that crashloops on Ada+/Blackwell (vgpuDeviceManager). |
| 10 | +# that crashloops on Ada+/Blackwell (vgpuDeviceManager). The same union |
| 11 | +# must hold for the `container` variant; the `vgpu` variant re-affirms |
| 12 | +# vgpuDeviceManager=false in its own overlay for the same reason. |
11 | 13 | # |
12 | | -# 2. Each variant's overlay must set sandboxWorkloads.defaultWorkload to its |
13 | | -# own enum value (vm-passthrough / vm-vgpu) — without it, GPU nodes that |
14 | | -# lack the per-node label nvidia.com/gpu.workload.config fall back to |
15 | | -# the upstream default 'container' workload, no DaemonSet renders, and |
16 | | -# the variant is silently a no-op. |
| 14 | +# 2. The sandbox variants must set sandboxWorkloads.defaultWorkload to |
| 15 | +# their own enum value (vm-passthrough / vm-vgpu) — without it, GPU |
| 16 | +# nodes that lack the per-node label nvidia.com/gpu.workload.config |
| 17 | +# fall back to the upstream default 'container' workload, no DaemonSet |
| 18 | +# renders, and the variant is silently a no-op. The container variant |
| 19 | +# relies on the same upstream default but in the opposite direction: |
| 20 | +# with sandboxWorkloads.enabled=false the chart picks defaultWorkload |
| 21 | +# 'container', which is what that variant wants — pinned here so an |
| 22 | +# upstream rename does not silently break it. |
17 | 23 | # |
18 | 24 | # 3. The vgpu variant must enable the vGPU manager DaemonSet |
19 | | -# (vgpuManager.enabled=true) and the passthrough variant must keep |
20 | | -# driver.enabled / devicePlugin.enabled at false. |
| 25 | +# (vgpuManager.enabled=true), the passthrough variant must keep |
| 26 | +# driver.enabled / devicePlugin.enabled at false, and the container |
| 27 | +# variant must keep driver / toolkit / vfioManager at false (host |
| 28 | +# already provides them) while keeping devicePlugin enabled (publishes |
| 29 | +# nvidia.com/gpu to the kubelet). |
21 | 30 | # |
22 | 31 | # Implementation: render the chart with the merged values for each variant |
23 | 32 | # and grep for the relevant ClusterPolicy keys. We strip the package's |
@@ -96,3 +105,26 @@ render_variant() { |
96 | 105 | grep -A 1 '^ driver:' "$TMP/rendered.yaml" | grep -q 'enabled: false' |
97 | 106 | grep -A 1 '^ devicePlugin:' "$TMP/rendered.yaml" | grep -q 'enabled: false' |
98 | 107 | } |
| 108 | + |
| 109 | +@test "container variant: ccManager and vgpuDeviceManager pinned off" { |
| 110 | + TMP=$(mktemp -d); trap 'rm -rf "$TMP"' EXIT |
| 111 | + render_variant container |
| 112 | + grep -A 1 '^ ccManager:' "$TMP/rendered.yaml" | grep -q 'enabled: false' |
| 113 | + grep -A 1 '^ vgpuDeviceManager:' "$TMP/rendered.yaml" | grep -q 'enabled: false' |
| 114 | +} |
| 115 | + |
| 116 | +@test "container variant: sandboxWorkloads off, defaultWorkload stays upstream 'container'" { |
| 117 | + TMP=$(mktemp -d); trap 'rm -rf "$TMP"' EXIT |
| 118 | + render_variant container |
| 119 | + grep -A 2 '^ sandboxWorkloads:' "$TMP/rendered.yaml" | grep -q 'enabled: false' |
| 120 | + grep -A 2 '^ sandboxWorkloads:' "$TMP/rendered.yaml" | grep -q 'defaultWorkload: container' |
| 121 | +} |
| 122 | + |
| 123 | +@test "container variant: driver, toolkit, vfioManager off; devicePlugin on" { |
| 124 | + TMP=$(mktemp -d); trap 'rm -rf "$TMP"' EXIT |
| 125 | + render_variant container |
| 126 | + grep -A 1 '^ driver:' "$TMP/rendered.yaml" | grep -q 'enabled: false' |
| 127 | + grep -A 1 '^ toolkit:' "$TMP/rendered.yaml" | grep -q 'enabled: false' |
| 128 | + grep -A 1 '^ vfioManager:' "$TMP/rendered.yaml" | grep -q 'enabled: false' |
| 129 | + grep -A 1 '^ devicePlugin:' "$TMP/rendered.yaml" | grep -q 'enabled: true' |
| 130 | +} |
0 commit comments