From 87ae088429d20a5437ee808adc3d1b3cc482af19 Mon Sep 17 00:00:00 2001 From: Vassiliy Yegorov Date: Mon, 11 Aug 2025 08:55:13 +0700 Subject: [PATCH] init --- README.md | 7 ------- start.sh | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 0b9c8d1..578e9ec 100644 --- a/README.md +++ b/README.md @@ -105,13 +105,6 @@ TALOS_CLUSTER_NAME=talos-nsk2 - IP Pool для LoadBalancer - L2 Announcement Policy -**Интерактивные подтверждения:** - -- Apply terraform changes? (y/n) -- Save kubeconfig? (y/n) -- Install Cilium? (y/n) -- Apply Cilium IP Pool and L2 Announcement Policy? (y/n) - ### destroy.sh - Удаление кластера Полная очистка инфраструктуры: diff --git a/start.sh b/start.sh index 5f4ea09..9bb528c 100755 --- a/start.sh +++ b/start.sh @@ -5,21 +5,24 @@ source .env export PROXMOX_VE_USERNAME=${PROXMOX_VE_USERNAME} export PROXMOX_VE_PASSWORD=${PROXMOX_VE_PASSWORD} +confirm() { + local message="$1" + read -p "$message (y/n): " response + [[ "$response" == "y" ]] +} + tfplan=$(terraform plan -out=tfplan) echo "$tfplan" -read -p "Apply? (y/n): " apply -if [ "$apply" == "y" ]; then +if confirm "Apply?"; then terraform apply tfplan fi -read -p "Save kubeconfig? (y/n): " save_kubeconfig -if [ "$save_kubeconfig" == "y" ]; then +if confirm "Save kubeconfig?"; then terraform output -raw kubeconfig > ~/.kube/${TALOS_CLUSTER_NAME}.yaml fi -read -p "Install Cilium? (y/n): " install_cilium -if [ "$install_cilium" == "y" ]; then +if confirm "Install Cilium?"; then helm repo add cilium https://helm.cilium.io/ helm repo update helm upgrade \ @@ -33,8 +36,7 @@ if [ "$install_cilium" == "y" ]; then --set cluster.id=1 fi -read -p "Apply Cilium IP Pool and L2 Announcement Policy? (y/n): " apply_ip_pool -if [ "$apply_ip_pool" == "y" ]; then +if confirm "Apply Cilium IP Pool and L2 Announcement Policy?"; then kubectl apply -f cilium/ippool.yaml kubectl apply -f cilium/l2-announcement-policy.yaml fi