test(e2e): enable gpu-operator in the e2e platform install

The GPU paths of cozystack-controller (the GPUClaim, VMI and pod
webhooks, the launcher scheduling gate, the GPU policies) render only
when gpu-operator serves GPUs to VMs, and the e2e install never
enabled it, so no lane could reach them. Enable it whenever the
selection keeps the package, and permit a fake device name in KubeVirt
as an external provider: a VM using a class on a name outside the
table is refused at admission, and CI has no GPUs to advertise a real
one.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
Aleksei Sviridkin committed 2026-10-27 10:20:59 +03:00
1 parent 57f709de9a
commit 5a9c19ce20
2 files changed
+47

No files matched your search

+24
View File
@@ -78,6 +78,19 @@ spec:
- cozystack.external-dns-application
EOF
# gpu-operator is optional, so a closure that keeps it still has to list it.
# Enabled, it turns on cozystack-controller's GPU paths, which the gpuclaim
# suite drives with a fake extended resource; KubeVirt must permit that name
# as an external provider, or a VM using a class on it is refused at
# admission.
gpu_operator=true
case " $disabled " in
*" cozystack.gpu-operator "*) gpu_operator=false ;;
esac
if [ "$gpu_operator" = true ]; then
echo " - cozystack.gpu-operator"
fi
if [ -n "$disabled" ]; then
echo " disabledPackages:"
for pkg in $disabled; do
@@ -85,6 +98,17 @@ if [ -n "$disabled" ]; then
done
fi
if [ "$gpu_operator" = true ]; then
cat <<'EOF'
gpu:
permittedHostDevices:
pciHostDevices:
- pciVendorSelector: "10DE:FFFF"
resourceName: nvidia.com/E2E_FAKE_GPU
externalResourceProvider: true
EOF
fi
if [ "$linstor_drbd_enabled" = false ]; then
cat <<'EOF'
---
+23
View File
@@ -166,6 +166,29 @@ load test_helper
done
}
@test "gpu-operator serves VMs and permits the fake GPU unless the selection drops it" {
manifest=$(hack/e2e-platform-packages.sh)
enabled=$(printf '%s\n' "$manifest" | yq '.spec.components.platform.values.bundles.enabledPackages | join(",")')
fake=$(printf '%s\n' "$manifest" | yq '.spec.components.platform.values.gpu.permittedHostDevices.pciHostDevices[] | select(.resourceName == "nvidia.com/E2E_FAKE_GPU") | .externalResourceProvider')
if [ "$enabled" != "cozystack.external-dns-application,cozystack.gpu-operator" ]; then
echo "an unscoped install does not enable gpu-operator: $enabled" >&2
return 1
fi
if [ "$fake" != "true" ]; then
echo "the fake GPU resource name is not permitted as an external provider: '$fake'" >&2
return 1
fi
manifest=$(COZY_DISABLED_PACKAGES="cozystack.gpu-operator" hack/e2e-platform-packages.sh)
enabled=$(printf '%s\n' "$manifest" | yq '.spec.components.platform.values.bundles.enabledPackages | join(",")')
gpu=$(printf '%s\n' "$manifest" | yq '.spec.components.platform.values | has("gpu")')
if [ "$enabled" != "cozystack.external-dns-application" ] || [ "$gpu" != "false" ]; then
echo "a selection without gpu-operator still enables it: enabled=$enabled gpu=$gpu" >&2
return 1
fi
}
@test "a malformed package name fails before emitting YAML" {
for bad in "goldpinger" "cozystack." "cozystack.Gold" "cozystack.a;b"; do
if manifest=$(COZY_DISABLED_PACKAGES="cozystack.keda $bad" hack/e2e-platform-packages.sh 2>/dev/null); then