wipe-all 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ARM=$(kubectl get nodes -o wide --show-labels | grep -v STATUS | grep -v master | grep arm64 | awk '{print $1}')
  2. X86=$(kubectl get nodes -o wide --show-labels | grep -v STATUS | grep -v control-plane | grep amd64 | awk '{print $1}')
  3. CONTROL=$(kubectl get nodes -o wide --show-labels | grep -v STATUS | grep control-plane| awk '{print $1}')
  4. DATA=$(kubectl get nodes -o wide --show-labels | grep -v STATUS | grep -v master| awk '{print $1}')
  5. for i in $DATA ; do
  6. ./bin/wipe-ceph $i /var/lib/ceph
  7. done
  8. for i in $CONTROL ; do
  9. ./bin/wipe-ceph $i /var/lib/ceph
  10. done
  11. for i in $DATA ; do
  12. ./bin/wipe-node $i
  13. done
  14. NODES=()
  15. for i in $DATA ; do
  16. echo mindwipe $i
  17. NODES+=(" -n $i ")
  18. done
  19. for i in $CONTROL ; do
  20. echo mindwipe $i
  21. NODES+=(" -n $i ")
  22. done
  23. #exit
  24. talosctl reset --system-labels-to-wipe STATE --system-labels-to-wipe EPHEMERAL --graceful=false --reboot ${NODES[@]}
  25. echo "Waiting for master node to come online"
  26. j=0
  27. while ! nc -z 192.168.0.11 50000 ; do
  28. j=$((j+1))
  29. echo $j
  30. done
  31. sleep 10
  32. echo "Applying config to control plane nodes"
  33. for i in $CONTROL; do
  34. while ! nc -z 192.168.0.11 50000 ; do
  35. j=$((j+1))
  36. echo $j
  37. done
  38. echo "Applying controlplane config to $i"
  39. talosctl apply --insecure -f nodeconfig/controlplane.yaml -n $i
  40. done
  41. sleep 10
  42. j=0
  43. while ! nc -z 192.168.0.11 50000 ; do
  44. j=$((j+1))
  45. echo $j
  46. done
  47. echo "bootstrap master"
  48. talosctl bootstrap -n 192.168.0.11
  49. sleep 20
  50. j=0
  51. while ! nc -z 192.168.0.11 6443 ; do
  52. j=$((j+1))
  53. echo $j
  54. done
  55. #echo "applying configs for x86 workers"
  56. #for i in $X86 ; do
  57. # echo "talosctl apply --insecure -f nodeconfig/worker.yaml -n $i"
  58. # talosctl apply --insecure -f nodeconfig/worker.yaml -n $i
  59. #done
  60. echo "sleeping 30"
  61. sleep 30
  62. echo "applying configs for arm workers"
  63. for i in $ARM ; do
  64. echo "talosctl apply --insecure -f nodeconfig/pi.yaml -n $i"
  65. talosctl apply --insecure -f nodeconfig/pi.yaml -n $i
  66. done