#!/usr/bin/env bash # infra/cluster.sh — RETIRED (libvirt era). DO NOT USE. # # This managed the ORIGINAL dev cluster: 3 libvirt/KVM VMs on the workstation, on the # 10.73.0.0/24 NAT network. That cluster no longer exists — the dev cluster was migrated to # Proxmox VE (nodes 192.168.1.50/.51/.52) and there are no local `k3s-dev-*` domains for # virsh to start or stop. It is kept only as a record of the retired lifecycle. # # What to use instead (see infra/PHASE1-STATUS.md): # VM power — the Proxmox UI / API on the Proxmox host, or `tofu` in infra/tofu # kubeconfig — ~/.kube/config context `k3s-oidc` (Keycloak SSO), or the break-glass # cert kubeconfig from the primary node # node access — ssh -p 225{0,1,2} k3s@192.168.2.102 (pfSense NAT) # cluster health — kubectl get nodes && flux get kustomizations set -euo pipefail export LIBVIRT_DEFAULT_URI=qemu:///system HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" KCFG="${HERE}/ansible/.cache/dev.kubeconfig" NODES=(k3s-dev-1 k3s-dev-2 k3s-dev-3) case "${1:-status}" in status) virsh list --all | grep -E 'k3s-dev|Name|--' || true if [ -f "$KCFG" ]; then KUBECONFIG="$KCFG" kubectl get nodes 2>/dev/null || echo "(cluster not reachable — VMs stopped? run: $0 start)"; fi ;; start) for n in "${NODES[@]}"; do virsh start "$n" 2>/dev/null || echo "$n already running"; done ;; stop) for n in "${NODES[@]}"; do virsh shutdown "$n" 2>/dev/null || true; done; echo "graceful shutdown sent (state persists on disk; '$0 start' to resume)" ;; kubeconfig) echo "export KUBECONFIG=${KCFG}" ;; *) echo "usage: $0 {status|start|stop|kubeconfig}"; exit 2 ;; esac