From f1c405aab4350a1188dc1927959f934dc750f997 Mon Sep 17 00:00:00 2001 From: juvdiaz Date: Sat, 27 Jun 2026 08:26:52 -0600 Subject: [PATCH] Keep Gitea running when stopping cluster --- README.md | 19 +++++++++++-------- bootstrap/edge/templates/default.conf.tftpl | 2 +- lab.sh | 13 ++++++++++--- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f7be138..211835c 100644 --- a/README.md +++ b/README.md @@ -265,14 +265,17 @@ PV data, or VM disks, run: ./lab.sh stop-cluster ``` -This stops `kubelet` and `containerd` on the Debian control plane, stops any -workers listed in `WORKER_SSH_TARGETS`, and gracefully shuts down automated -Pimox worker VMs. It does not run `kubeadm reset`, delete CNI files, or remove -state. Use `LAB_CLUSTER_STOP_VM_TIMEOUT_SECONDS` to change the Pimox shutdown -timeout, `LAB_CLUSTER_STOP_FORCE=false` to avoid a hard `qm stop` after timeout, -and the usual `LAB_PIMOX_WORKER_COUNT`, `LAB_PIMOX_WORKER_BASE_VMID`, and -`LAB_PIMOX_SKIP_WORKER_INDEXES` variables to select VM workers. Resume the -runtime with: +This stops `kubelet`, stops Kubernetes CRI containers with `crictl` when +available, stops any workers listed in `WORKER_SSH_TARGETS`, and gracefully +shuts down automated Pimox worker VMs. It intentionally leaves the host +`containerd`/Docker stack running so external Docker Compose services such as +Gitea stay online. It does not run `kubeadm reset`, delete CNI files, or remove +state. Use `LAB_CLUSTER_STOP_CONTAINERD=true` only when you intentionally want +to stop the host container runtime too. Use `LAB_CLUSTER_STOP_VM_TIMEOUT_SECONDS` +to change the Pimox shutdown timeout, `LAB_CLUSTER_STOP_FORCE=false` to avoid a +hard `qm stop` after timeout, and the usual `LAB_PIMOX_WORKER_COUNT`, +`LAB_PIMOX_WORKER_BASE_VMID`, and `LAB_PIMOX_SKIP_WORKER_INDEXES` variables to +select VM workers. Resume the runtime with: ```bash ./lab.sh start-cluster diff --git a/bootstrap/edge/templates/default.conf.tftpl b/bootstrap/edge/templates/default.conf.tftpl index 032c2ea..714cb94 100644 --- a/bootstrap/edge/templates/default.conf.tftpl +++ b/bootstrap/edge/templates/default.conf.tftpl @@ -86,7 +86,7 @@ server { limit_req zone=one burst=20 nodelay; client_max_body_size 512m; - proxy_pass http://${gitea_backend_host}:${gitea_backend_port}/; + proxy_pass http://${gitea_backend_host}:${gitea_backend_port}; proxy_http_version 1.1; proxy_request_buffering off; proxy_read_timeout 300s; diff --git a/lab.sh b/lab.sh index 88d2409..388dbe6 100755 --- a/lab.sh +++ b/lab.sh @@ -3259,13 +3259,20 @@ cluster_worker_targets() { stop_local_kubernetes_services() { echo "--> Stopping local Kubernetes services on the Debian control plane..." sudo systemctl stop kubelet 2>/dev/null || true - sudo systemctl stop containerd 2>/dev/null || true - sudo systemctl reset-failed kubelet containerd 2>/dev/null || true + if command -v crictl >/dev/null 2>&1; then + sudo crictl stop --all 2>/dev/null || true + fi + if truthy "${LAB_CLUSTER_STOP_CONTAINERD:-false}"; then + sudo systemctl stop containerd 2>/dev/null || true + sudo systemctl reset-failed containerd 2>/dev/null || true + fi + sudo systemctl reset-failed kubelet 2>/dev/null || true } start_local_kubernetes_services() { echo "--> Starting local Kubernetes services on the Debian control plane..." sudo systemctl start containerd + sudo systemctl start docker 2>/dev/null || true sudo systemctl start kubelet } @@ -3274,7 +3281,7 @@ stop_remote_kubernetes_services() { echo "--> Stopping Kubernetes services on remote worker ${target}..." ssh -o ConnectTimeout=5 "${target}" \ - "sudo systemctl stop kubelet 2>/dev/null || true; sudo systemctl stop containerd 2>/dev/null || true; sudo systemctl reset-failed kubelet containerd 2>/dev/null || true" + "sudo systemctl stop kubelet 2>/dev/null || true; if command -v crictl >/dev/null 2>&1; then sudo crictl stop --all 2>/dev/null || true; fi; if [ '${LAB_CLUSTER_STOP_CONTAINERD:-false}' = 'true' ]; then sudo systemctl stop containerd 2>/dev/null || true; sudo systemctl reset-failed containerd 2>/dev/null || true; fi; sudo systemctl reset-failed kubelet 2>/dev/null || true" } start_remote_kubernetes_services() {