Skip to content

Commit 865410b

Browse files
committed
k3d-gpu-plus: up waits briefly for k3s to auto-deploy the baked plugin
The baked device plugin lands a few seconds after the server starts, so a single get-daemonset check raced it and fell through to the fallback apply. Poll up to 20s for the auto-deployed DaemonSet before applying, so the baked path is used (no double-management) and the fallback only fires for custom images that truly lack it.
1 parent 24b1dc8 commit 865410b

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

scripts/k3d-gpu

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,15 @@ cmd_up() {
126126
kubectl wait --for=condition=Ready nodes --all --timeout=120s
127127

128128
# The cryptoandcoffee/k3d-gpu image bakes the device plugin into k3s's
129-
# auto-deploy dir, so k3s applies it on startup — no action needed here. Only
130-
# apply it ourselves if a custom image (K3D_GPU_IMAGE) didn't ship it.
131-
if kubectl -n kube-system get daemonset nvidia-device-plugin-daemonset >/dev/null 2>&1; then
129+
# auto-deploy dir, so k3s applies it on startup — no action needed here. Give
130+
# the addon a moment to appear; only apply it ourselves if a custom image
131+
# (K3D_GPU_IMAGE) didn't ship it.
132+
local baked=0 dl=$((SECONDS + 20))
133+
while [ "${SECONDS}" -lt "${dl}" ]; do
134+
kubectl -n kube-system get daemonset nvidia-device-plugin-daemonset >/dev/null 2>&1 && { baked=1; break; }
135+
sleep 2
136+
done
137+
if [ "${baked}" -eq 1 ]; then
132138
info "Device plugin auto-deployed by k3s."
133139
elif [ -f "${PLUGIN_MANIFEST}" ]; then
134140
info "Applying NVIDIA device plugin (${PLUGIN_MANIFEST})..."

0 commit comments

Comments
 (0)