Skip to content

Commit 1488df4

Browse files
committed
merge: resolve conflict with main in provisioning script
Keep both the CPU state check (from main) and the Tailscale IP auto-reconciliation drop-in + vpn-auth removal (from this branch).
2 parents cf97681 + 1131d24 commit 1488df4

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

src/game-server-node/game-server-node.controller.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,29 @@ cat <<-EOF >/etc/rancher/k3s/config.yaml
500500
- "kube-reserved=cpu=1"
501501
EOF
502502
503-
# Auto-reconcile Tailscale IP on every k3s-agent start/restart
503+
cat <<-'SCRIPT' >/usr/local/bin/5stack-cpu-state-check.sh
504+
#!/bin/bash
505+
STATE=/var/lib/kubelet/cpu_manager_state
506+
[ ! -f "$STATE" ] && exit 0
507+
CACHE="$(dirname "$STATE")/cpu_count"
508+
CURRENT=$(nproc)
509+
PREVIOUS=$(cat "$CACHE" 2>/dev/null || echo "$CURRENT")
510+
if [ "$CURRENT" != "$PREVIOUS" ]; then
511+
echo "CPU count changed from $PREVIOUS to $CURRENT, removing $STATE"
512+
rm -f "$STATE"
513+
fi
514+
echo "$CURRENT" > "$CACHE"
515+
SCRIPT
516+
chmod +x /usr/local/bin/5stack-cpu-state-check.sh
517+
504518
mkdir -p /etc/systemd/system/k3s-agent.service.d
519+
520+
cat <<-'DROPIN' >/etc/systemd/system/k3s-agent.service.d/cpu-state-check.conf
521+
[Service]
522+
ExecStartPre=/usr/local/bin/5stack-cpu-state-check.sh
523+
DROPIN
524+
525+
# Auto-reconcile Tailscale IP on every k3s-agent start/restart
505526
cat <<-'DROPIN' >/etc/systemd/system/k3s-agent.service.d/update-tailscale-ip.conf
506527
[Service]
507528
ExecStartPre=/bin/bash -c 'TSIP=$(tailscale ip -4 2>/dev/null | head -n 1); if [ -n "$TSIP" ] && [ -f /etc/rancher/k3s/config.yaml ]; then sed -i "s/^node-ip:.*/node-ip: $TSIP/" /etc/rancher/k3s/config.yaml; echo "[5stack] Updated k3s node-ip to $TSIP"; fi'
@@ -510,6 +531,7 @@ DROPIN
510531
# Remove one-time auth key from k3s-agent service to prevent
511532
# re-auth failures with expired key on future reboots
512533
sed -i '/--vpn-auth/d' /etc/systemd/system/k3s-agent.service
534+
513535
systemctl daemon-reload
514536
515537
rm -f /var/lib/kubelet/cpu_manager_state

0 commit comments

Comments
 (0)