diff --git a/lab.sh b/lab.sh index deb50ec..8653d12 100755 --- a/lab.sh +++ b/lab.sh @@ -595,6 +595,19 @@ with open(var_file, "w", encoding="utf-8") as handle: PY } +prepare_cluster_worker_var_file() { + local include_raspberry_default="$1" + local spec_file="${REPO_ROOT}/.lab/manual-workers.tsv" + local var_file="${REPO_ROOT}/.lab/cluster-workers.auto.tfvars.json" + + export LAB_INCLUDE_RASPBERRY_WORKER="${LAB_INCLUDE_RASPBERRY_WORKER:-${include_raspberry_default}}" + + mkdir -p "${REPO_ROOT}/.lab" + : >"${spec_file}" + write_cluster_worker_var_file "${spec_file}" "${var_file}" + export LAB_CLUSTER_VAR_FILE="${var_file}" +} + run_pimox_pipeline() { local mode="${LAB_PIMOX_PIPELINE:-false}" local pimox_host="${LAB_PIMOX_HOST:-${TF_VAR_pimox_host:-192.168.100.80}}" @@ -2486,6 +2499,7 @@ up() { deploy_gitea bootstrap_gitea_repo + prepare_cluster_worker_var_file true run_tofu_stack "bootstrap/cluster" run_tofu_stack "bootstrap/platform" apps @@ -2497,12 +2511,12 @@ up() { rebuild_cluster() { require_debian_server "rebuild-cluster" - export LAB_INCLUDE_RASPBERRY_WORKER="${LAB_INCLUDE_RASPBERRY_WORKER:-false}" export WORKER_SSH_TARGETS="${WORKER_SSH_TARGETS:-}" echo "Rebuilding the Kubernetes cluster without touching external Raspberry Pi Gitea..." nuke + prepare_cluster_worker_var_file true run_tofu_stack "bootstrap/cluster" run_tofu_stack "bootstrap/platform" apps