From fcc3b3dfb43df9f8b26f57c797cb875c6e8dbdfd Mon Sep 17 00:00:00 2001 From: Flegma Date: Mon, 20 Jul 2026 21:13:32 +0200 Subject: [PATCH] feat: pre-warm tailscale path to k3s server on game node start The script served by GET /game-server-node/script/:id is the canonical agent-provisioning path (curl | bash from the panel). After a reboot the Tailscale direct path to the k3s server can come up one-way (tx>0, rx0); tailscaled self-reports healthy, so the existing tailscale-state-check passes while the agent cannot reach the control plane: k3s-agent hangs validating the connection, no pods schedule (including game-server-node-connector), and the node shows Offline. Add a best-effort ExecStartPre drop-in (tailscale-prewarm.conf) that, before k3s-agent starts, runs a bounded tailscale ping to the server parsed from K3S_URL, forcing the direct path to establish bidirectionally. Prefixed with - and wrapped in || true so a failed pre-warm can never block k3s-agent from starting. Mirrors 5stack-panel PR #573. --- src/game-server-node/game-server-node.controller.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/game-server-node/game-server-node.controller.ts b/src/game-server-node/game-server-node.controller.ts index 46bf55e8..1524d884 100644 --- a/src/game-server-node/game-server-node.controller.ts +++ b/src/game-server-node/game-server-node.controller.ts @@ -715,6 +715,15 @@ cat <<-'DROPIN' >/etc/systemd/system/k3s-agent.service.d/tailscale-state-check.c ExecStartPre=/usr/local/bin/5stack-tailscale-state-check.sh DROPIN +cat <<-'DROPIN' >/etc/systemd/system/k3s-agent.service.d/tailscale-prewarm.conf + [Unit] + After=tailscaled.service + Wants=tailscaled.service + + [Service] + ExecStartPre=-/bin/bash -c '. /etc/systemd/system/k3s-agent.service.env 2>/dev/null || true; H=$(echo "\${K3S_URL#*://}" | cut -d: -f1 | cut -d/ -f1); [ -n "$H" ] && echo "[5stack] pre-warming tailscale path to $H" && timeout 15 tailscale ping -c 3 "$H" >/dev/null 2>&1 || true' +DROPIN + cat <<-'UNIT' >/etc/systemd/system/5stack-tailscale-state-check.service [Unit] Description=5stack tailscale state check