Enhancement: Harden k8s-bootstrap commands against silent failures #56

Merged
claude-bot Bot merged 1 commits from enhancement/harden-k8s-bootstrap into main 2026-11-23 00:40:15 +01:00

What changed

  • Ignore connection changes on bootstrap commands, so a changed node IP or SSH key cannot re-run them on live nodes.
  • Pin k3s installs to v1.36.2+k3s1, the version the cluster runs.
  • Longhorn disk step: run mkfs only when blkid reports an empty disk, stop if more than one disk matches, avoid duplicate fstab lines, and fail if the disk is not mounted.
  • Package install: wait for cloud-init and for the apt lock.
  • VIP check: pass only on HTTP 200, 401 or 403.
  • VM start: skip running VMs, and fail if a VM does not reach running.
  • Mark the get-kubeconfig stdout as a secret.

Why

These steps could re-run on live nodes or report success without reaching the desired state. The changed commands only apply on a fresh install, because create changes are ignored.

Preview

k8s-bootstrap: 1 to create (wait-control-plane-vip-ready), 30 unchanged. Typecheck passes.

Not tested

The rewritten shell commands were syntax-checked but not run. The VM start script needs Proxmox tokens with VM.Audit as well as VM.PowerMgmt, which has not been confirmed. This stack deploys only through the manual workflow.

## What changed - Ignore `connection` changes on bootstrap commands, so a changed node IP or SSH key cannot re-run them on live nodes. - Pin k3s installs to `v1.36.2+k3s1`, the version the cluster runs. - Longhorn disk step: run `mkfs` only when `blkid` reports an empty disk, stop if more than one disk matches, avoid duplicate fstab lines, and fail if the disk is not mounted. - Package install: wait for cloud-init and for the apt lock. - VIP check: pass only on HTTP 200, 401 or 403. - VM start: skip running VMs, and fail if a VM does not reach `running`. - Mark the `get-kubeconfig` stdout as a secret. ## Why These steps could re-run on live nodes or report success without reaching the desired state. The changed commands only apply on a fresh install, because `create` changes are ignored. ## Preview `k8s-bootstrap`: 1 to create (`wait-control-plane-vip-ready`), 30 unchanged. Typecheck passes. ## Not tested The rewritten shell commands were syntax-checked but not run. The VM start script needs Proxmox tokens with `VM.Audit` as well as `VM.PowerMgmt`, which has not been confirmed. This stack deploys only through the manual workflow.
claude-bot Bot added 1 commit 2026-11-23 00:39:00 +01:00
enhancement(k8s-bootstrap): harden bootstrap commands against silent failures
Deploy k8s Bootstrap / Bootstrap k3s Cluster (pull_request) Skipped
Deploy k8s Bootstrap / Pulumi Preview (pull_request) Successful in 39s
Secret Scan / Betterleaks (pull_request) Successful in 7s
13330ef3fb
A changed node IP or SSH key could re-run the unpinned k3s installer on live nodes, so ignore connection changes and pin k3s to the version the cluster runs.

Several steps reported success without reaching the desired state: a failed Longhorn mount fell through to the root disk, any HTTP error passed the VIP check, and VM start errors were swallowed. Each step now checks its outcome. mkfs only runs when blkid reports an empty disk, and package installs wait for cloud-init.
claude-bot Bot merged commit 6647d55050 into main 2026-11-23 00:40:15 +01:00
Sign in to join this conversation.