#!/bin/bash set -e export TALOSCONFIG=/home/scooby/Talosv3/talosconfig echo "=== Talos iSCSI Bootstrap Script ===" echo "" echo "This script configures Talos nodes for Longhorn by:" echo "1. Enabling control plane scheduling" echo "2. Adding Longhorn volume mounts" echo "3. Upgrading to factory image with iscsi-tools" echo "" # Step 1: Enable scheduling on control planes echo "Step 1/4: Enabling scheduling on control planes..." cat > /tmp/allow-scheduling.yaml < /tmp/longhorn-volume.patch.yaml < /tmp/clear-extensions.yaml </dev/null || true echo "✅ Old extensions removed" # Step 4: Upgrade to factory image with iscsi-tools echo "" echo "Step 4/4: Upgrading to Talos with iscsi-tools (this will take several minutes)..." echo "Factory image includes: iscsi-tools, util-linux-tools" echo "" SCHEMATIC_ID="613e1592b2da41ae5e265e8789429f22e121aab91cb4deb6bc3c0b6262961245" TALOS_VERSION="v1.9.4" echo "Upgrading nodes one at a time to: factory.talos.dev/installer/$SCHEMATIC_ID:$TALOS_VERSION" for node in 172.28.101.41 172.28.101.42 172.28.101.43 172.28.101.44; do echo "" echo "Upgrading $node..." talosctl upgrade --nodes $node \ --image factory.talos.dev/installer/$SCHEMATIC_ID:$TALOS_VERSION \ --preserve --wait --timeout 10m || echo "⚠️ Node $node upgrade encountered issues, continuing..." echo "Waiting 30s for node to stabilize..." sleep 30 done echo "" echo "=== Waiting for all nodes to be Ready ===" kubectl wait --for=condition=Ready nodes --all --timeout=300s echo "" echo "=== Verifying iSCSI installation ===" talosctl get extensions -n 172.28.101.41 echo "" echo "✅ Talos iSCSI bootstrap complete!" echo "" echo "Next steps:" echo " cd /home/scooby/Homelabv5" echo " ./scripts/bootstrap-crds.sh" echo " helmfile apply"