Files
homelab/talos/talhelper/rolling-upgrade-workers.sh
Hermes Agent service account 99958979d6 Add Talos upgrade and system extensions documentation
- Add comprehensive UPGRADES-AND-EXTENSIONS.md guide covering:
  - System extensions via schematics and Image Factory
  - Talos version upgrade procedures (control plane + workers)
  - Kubernetes version upgrades
  - Rolling upgrade best practices
  - Troubleshooting common upgrade issues
- Add rolling-upgrade-workers.sh script for automated worker upgrades
- Includes safe wait times and confirmation prompts
2026-06-18 22:38:33 -05:00

67 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# Rolling upgrade script for fastpass worker nodes
# Usage: ./rolling-upgrade-workers.sh <image-url>
# Example: ./rolling-upgrade-workers.sh factory.talos.dev/installer/abc123:v1.14.0
set -e
IMAGE="$1"
if [ -z "$IMAGE" ]; then
echo "Usage: $0 <image-url>"
echo ""
echo "Example:"
echo " $0 factory.talos.dev/installer/abc123def456:v1.14.0"
echo ""
echo "To get the image URL, run:"
echo " cd /opt/git/homelab/talos/talhelper"
echo " talhelper genconfig"
echo " grep 'image:' clusterconfig/fastpass-jungle-cruise.yaml | head -1"
exit 1
fi
declare -A WORKERS=(
["jungle-cruise"]="10.1.71.69"
["haunted-mansion"]="10.1.71.70"
["peter-pans-flight"]="10.1.71.71"
)
echo "=========================================="
echo "Rolling Worker Upgrade"
echo "=========================================="
echo "Image: $IMAGE"
echo "Workers: ${!WORKERS[@]}"
echo ""
read -p "Proceed with rolling upgrade? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Aborted."
exit 0
fi
for worker in jungle-cruise haunted-mansion peter-pans-flight; do
ip="${WORKERS[$worker]}"
echo ""
echo "=========================================="
echo "Upgrading $worker ($ip)..."
echo "=========================================="
talosctl upgrade --nodes ${ip} --image ${IMAGE} --preserve
echo "Waiting for $worker to be Ready..."
kubectl wait --for=condition=Ready node/${worker} --timeout=10m
echo "$worker upgrade complete."
if [ "$worker" != "peter-pans-flight" ]; then
echo "Sleeping 30s before next node..."
sleep 30
fi
done
echo ""
echo "=========================================="
echo "✓ All workers upgraded successfully!"
echo "=========================================="
echo ""
kubectl get nodes -o wide