diff --git a/packages/core/platform/templates/apps.yaml b/packages/core/platform/templates/apps.yaml index e04fd89ff..a146e8554 100644 --- a/packages/core/platform/templates/apps.yaml +++ b/packages/core/platform/templates/apps.yaml @@ -290,6 +290,12 @@ stringData: (Tenant/root spec.ingress). `dig`, as for monitoring-enabled above, so an explicit false survives. */}} ingress-enabled: {{ dig "rootEnabled" true (.Values.ingress | default dict) | quote }} + {{- /* The root tenant's vGPU entitlement, read by cozystack-basics. + Only written when on: every release in every tenant reads this + Secret, and a key appearing would upgrade all of them. */}} + {{- if eq (printf "%v" ((.Values.gpu).vgpu | default false)) "true" }} + gpu-vgpu: "true" + {{- end }} {{- /* The rate each shared-central tracing tenant's collector holds it to. Only written when set: every release in every tenant reads this Secret, and a key appearing would upgrade all of them. */}} diff --git a/packages/core/platform/tests/apps_gpu_vgpu_wiring_test.yaml b/packages/core/platform/tests/apps_gpu_vgpu_wiring_test.yaml new file mode 100644 index 000000000..f7b7712af --- /dev/null +++ b/packages/core/platform/tests/apps_gpu_vgpu_wiring_test.yaml @@ -0,0 +1,42 @@ +suite: apps.yaml gpu.vgpu → _cluster wiring +templates: + - templates/apps.yaml +release: + name: cozy-platform + namespace: cozy-system + +# gpu.vgpu entitles the root tenant to vGPU, and every child's entitlement +# needs its parent's. cozystack-basics renders the root tenant from +# _cluster.gpu-vgpu. The key is written only when on: _cluster is copied into +# every tenant's cozystack-values, so a key that is always present would +# upgrade every release in every tenant. +tests: + - it: writes gpu-vgpu when gpu.vgpu is on + set: + gpu.vgpu: true + asserts: + - matchRegex: + path: stringData["values.yaml"] + pattern: '(?m)^_cluster:\n( .*\n)* gpu-vgpu: "true"$' + + - it: leaves gpu-vgpu out by default + asserts: + - notMatchRegex: + path: stringData["values.yaml"] + pattern: gpu-vgpu + + - it: leaves gpu-vgpu out for a quoted "false" + set: + gpu.vgpu: "false" + asserts: + - notMatchRegex: + path: stringData["values.yaml"] + pattern: gpu-vgpu + + - it: does not fail on a null gpu block + set: + gpu: null + asserts: + - notMatchRegex: + path: stringData["values.yaml"] + pattern: gpu-vgpu diff --git a/packages/core/platform/tests/bundles_gpu_kubevirt_wiring_test.yaml b/packages/core/platform/tests/bundles_gpu_kubevirt_wiring_test.yaml index 997f8c50d..066677a7b 100644 --- a/packages/core/platform/tests/bundles_gpu_kubevirt_wiring_test.yaml +++ b/packages/core/platform/tests/bundles_gpu_kubevirt_wiring_test.yaml @@ -949,3 +949,56 @@ tests: - contains: path: spec.components.kubevirt.values.mediatedDevicesConfiguration.mediatedDeviceTypes content: nvidia-473 + + # gpu.vgpu feeds the tenant entitlement, not KubeVirt or the GPU Operator. + - it: keeps gpu.vgpu out of the kubevirt component + set: + bundles: + system: + enabled: true + variant: isp-full + iaas: + enabled: true + enabledPackages: + - cozystack.gpu-operator + gpu: + vgpu: true + documentSelector: + path: metadata.name + value: cozystack.kubevirt + asserts: + - equal: + path: spec.components.kubevirt.values.extraFeatureGates + value: + - HostDevices + - contains: + path: spec.components.kubevirt.values.permittedHostDevices.pciHostDevices + content: + pciVendorSelector: "10DE:2335" + resourceName: nvidia.com/GH100_H200_SXM_141GB + externalResourceProvider: true + - notExists: + path: spec.components.kubevirt.values.vgpu + + - it: keeps gpu.vgpu out of the gpu-operator Package under vgpu + set: + bundles: + system: + enabled: true + variant: isp-full + iaas: + enabled: true + gpuOperatorVariant: vgpu + enabledPackages: + - cozystack.gpu-operator + gpu: + vgpu: true + documentSelector: + path: metadata.name + value: cozystack.gpu-operator + asserts: + - equal: + path: spec.variant + value: vgpu + - notExists: + path: spec.components diff --git a/packages/core/platform/values.yaml b/packages/core/platform/values.yaml index 4b7ae0e50..0b4d89a44 100644 --- a/packages/core/platform/values.yaml +++ b/packages/core/platform/values.yaml @@ -1036,6 +1036,10 @@ gpu: # missing entries). vgpuDeviceManager: enabled: false + # Entitle the root tenant to vGPU classes. Every other tenant is entitled + # only when its own Tenant sets gpu.vgpu and its parent is entitled, so + # vGPU reaches no tenant until this is on. + vgpu: false # VM import from external virtualization platforms (opt-in; see the iaas bundle). vmImport: