From 0977ad1a9ba049dde5902ef7a9cd820cec5d9cb7 Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Wed, 7 Oct 2026 10:00:26 -0600 Subject: [PATCH] fix: size Pimox guest disks through pipeline --- bootstrap/cluster/main.tf | 4 +- bootstrap/provisioning/README.md | 12 +- .../templates/golden-node-prepare.sh.tftpl | 4 +- bootstrap/provisioning/variables.tf | 2 +- docs/deployment.md | 114 +++++++++-------- docs/templates/deployment.md.tmpl | 114 +++++++++-------- lib/jeannie/pipeline.sh | 117 +++++++++++++++++- 7 files changed, 255 insertions(+), 112 deletions(-) diff --git a/bootstrap/cluster/main.tf b/bootstrap/cluster/main.tf index e5a6c71..96be04d 100644 --- a/bootstrap/cluster/main.tf +++ b/bootstrap/cluster/main.tf @@ -378,7 +378,7 @@ REGISTRY_EOT } configure_node_dns -install_missing_packages ca-certificates curl gpg apt-transport-https containernetworking-plugins open-iscsi nfs-common +install_missing_packages ca-certificates curl gpg apt-transport-https containernetworking-plugins open-iscsi nfs-common cri-tools cloud-guest-utils e2fsprogs install_containerd_runtime install_cni_plugins sudo systemctl enable --now iscsid @@ -1099,7 +1099,7 @@ REGISTRY_EOT } configure_node_dns -install_missing_packages ca-certificates curl gpg apt-transport-https containernetworking-plugins open-iscsi nfs-common +install_missing_packages ca-certificates curl gpg apt-transport-https containernetworking-plugins open-iscsi nfs-common cri-tools cloud-guest-utils e2fsprogs install_containerd_runtime install_tailscale install_cni_plugins diff --git a/bootstrap/provisioning/README.md b/bootstrap/provisioning/README.md index b85eb11..a3e9118 100644 --- a/bootstrap/provisioning/README.md +++ b/bootstrap/provisioning/README.md @@ -128,18 +128,18 @@ template build timeout. Defaults match the observed Pimox template VM shape: OVMF firmware, virtio networking, virtio-scsi disk, `vmbr0`, `local` template storage, 1 socket with -2 cores, and 8 GiB memory. The native `qm` CPU topology is the only `-smp` -argument; the provisioning stack removes legacy `args` values to prevent a -second conflicting `-smp` option. -Override `TF_VAR_pimox_template_scsi0`, +2 cores, 8 GiB memory, and a 30 GiB root disk. The native `qm` CPU topology is +the only `-smp` argument; the provisioning stack removes legacy `args` values to +prevent a second conflicting `-smp` option. +Override `TF_VAR_pimox_template_scsi0`, `LAB_PIMOX_TEMPLATE_DISK_GIB`, `TF_VAR_pimox_template_efidisk0`, `TF_VAR_pimox_template_cores`, or `TF_VAR_pimox_template_memory` if the Orange Pi template layout changes. `./jeannie up` also creates or reuses worker clones after the template exists. It defaults to one worker, VMID `9010`, name `pimox-worker-01`, deterministic locally administered MAC address, 1 socket -with 2 cores, 8 GiB RAM, `opi5_ssd` clone storage, and qemu-guest-agent IP -discovery when that Pimox storage is available. New workers are full clones +with 2 cores, 8 GiB RAM, 30 GiB root disk, `opi5_ssd` clone storage, and +qemu-guest-agent IP discovery when that Pimox storage is available. New workers are full clones created with `qm clone --storage`, so the template can remain on `local` while worker disks land on the Orange Pi SSD-backed non-local Pimox datastore. Keep durable data on the HP Debian laptop's `data-vg` or external backups and treat diff --git a/bootstrap/provisioning/templates/golden-node-prepare.sh.tftpl b/bootstrap/provisioning/templates/golden-node-prepare.sh.tftpl index 9172f15..852b5f9 100644 --- a/bootstrap/provisioning/templates/golden-node-prepare.sh.tftpl +++ b/bootstrap/provisioning/templates/golden-node-prepare.sh.tftpl @@ -96,8 +96,8 @@ install_kubernetes_tools() { curl -fsSL "https://pkgs.k8s.io/core:/stable:/${kubernetes_minor_version}/deb/Release.key" | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg printf 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/${kubernetes_minor_version}/deb/ /\n' >/etc/apt/sources.list.d/kubernetes.list apt-get update - apt-get install -y --no-install-recommends kubelet kubeadm kubectl - apt-mark hold kubelet kubeadm kubectl + apt-get install -y --no-install-recommends kubelet kubeadm kubectl cri-tools cloud-guest-utils e2fsprogs + apt-mark hold kubelet kubeadm kubectl cri-tools } install_containerd_runtime() { diff --git a/bootstrap/provisioning/variables.tf b/bootstrap/provisioning/variables.tf index 028373f..ede0cd1 100644 --- a/bootstrap/provisioning/variables.tf +++ b/bootstrap/provisioning/variables.tf @@ -227,7 +227,7 @@ variable "pimox_template_mac" { variable "pimox_template_scsi0" { type = string - default = "local:15" + default = "local:30" } variable "pimox_template_efidisk0" { diff --git a/docs/deployment.md b/docs/deployment.md index 57dfe5a..5806de8 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -317,9 +317,10 @@ Set `LAB_PIMOX_PIPELINE=false` to skip Pimox automation. Set keeps the template on its configured `local` storage, creates new worker VM clones on `opi5_ssd` by default when that Pimox storage is available, checks that the Pimox bridge already exists, refuses `local` as worker clone -storage, and refuses to edit Orange Pi host networking. Keep durable data on -the HP Debian laptop's `data-vg` or external backups; treat Orange Pi VM disks -as rebuildable worker capacity. +storage, grows existing Pimox guest root filesystems to the configured profile +size, and refuses to edit Orange Pi host networking. Keep durable data on the HP +Debian laptop's `data-vg` or external backups; treat Orange Pi VM disks as +rebuildable worker capacity. `LAB_PIMOX_SKIP_WORKER_INDEXES` defaults to an empty value, so the pipeline owns worker index `1` and VMID `9010` when `LAB_PIMOX_WORKER_COUNT=1`. Set @@ -689,16 +690,21 @@ For Pimox on Orange Pi 5 Plus, `./jeannie up` can create the Debian 13 arm64 template and worker VM clones automatically when the Orange Pi storage path is healthy. Defaults are intentionally tied to the observed host: Pimox SSH host `192.168.100.80`, bridge `vmbr0`, template VMID `9000` on `local` storage, two -8 GiB worker VMs starting at VMID `9010`, worker clone storage `opi5_ssd`, -and KVM launch affinity `4-7` because this Pimox is pinned to Debian Bullseye -on an Orange Pi 5 Plus. Jeannie launches the generated KVM command under that -host CPU set so PSCI can bring both guest CPUs online; it removes legacy `args` -entries so native `qm` CPU topology is the only `-smp` argument. Set -`LAB_PIMOX_KVM_CPUSET=` to use normal `qm start` on a different host. The NVMe -that was previously attached to the Orange Pi now belongs to the HP Debian -laptop as LVM volume group `data-vg`; the current Orange Pi SSD-backed Pimox -datastore is `opi5_ssd` and is used for rebuildable VM root disks. Details and -override variables are in +8 GiB-memory worker VMs starting at VMID `9010`, worker clone storage +`opi5_ssd`, 30 GiB template/control-plane/worker root disks, and KVM launch +affinity `4-7` because this Pimox is pinned to Debian Bullseye on an Orange Pi +5 Plus. Jeannie launches the generated KVM command under that host CPU set so +PSCI can bring both guest CPUs online; it removes legacy `args` entries so +native `qm` CPU topology is the only `-smp` argument. Set +`LAB_PIMOX_KVM_CPUSET=` to use normal `qm start` on a different host. Override +disk sizing with `LAB_PIMOX_TEMPLATE_DISK_GIB`, +`LAB_PIMOX_CONTROL_PLANE_DISK_GIB`, and `LAB_PIMOX_WORKER_DISK_GIB`; Jeannie +installs `cloud-guest-utils`, `e2fsprogs`, and `cri-tools`, resizes the Pimox +disk, and grows the guest root filesystem during the pipeline. The NVMe that +was previously attached to the Orange Pi now belongs to the HP Debian laptop as +LVM volume group `data-vg`; the current Orange Pi SSD-backed Pimox datastore is +`opi5_ssd` and is used for rebuildable VM root disks. Details and override +variables are in `bootstrap/provisioning/README.md`. Worker indexes are stable. Index `1` maps to VMID `9010`, node name @@ -758,12 +764,12 @@ Run a full cluster rebuild from the Debian server with: ./jeannie rebuild-cluster ``` -That path preserves external Gitea, rebuilds the Pimox template -with 2 cores and 8 GiB memory, replaces two Pimox worker VMs with 2 cores and -8 GiB memory, and joins those workers to the Kubernetes cluster. Pimox 7 ARM -does not support `qm --affinity`; Jeannie instead starts the generated KVM -command under CPU set `4-7` and verifies every worker reports two guest CPUs -before Kubernetes workloads proceed. +That path preserves external Gitea, rebuilds the Pimox template with 2 cores, +8 GiB memory, and a 30 GiB default root disk, replaces two Pimox worker VMs with +2 cores, 8 GiB memory, and 30 GiB root disks, and joins those workers to the +Kubernetes cluster. Pimox 7 ARM does not support `qm --affinity`; Jeannie +instead starts the generated KVM command under CPU set `4-7` and verifies every +worker reports two guest CPUs before Kubernetes workloads proceed. The Raspberry Pi is still included as a Kubernetes worker by default; `nuke` does not clean it unless you explicitly add it to `WORKER_SSH_TARGETS`. @@ -1857,15 +1863,20 @@ For Pimox on Orange Pi 5 Plus, `./jeannie up` can create the Debian 13 arm64 template and worker VM clones automatically when the Orange Pi storage path is healthy. Defaults are intentionally tied to the observed host: Pimox SSH host `192.168.100.80`, bridge `vmbr0`, template VMID `9000` on `local` storage, two -8 GiB worker VMs starting at VMID `9010`, worker clone storage `opi5_ssd`, -and KVM launch affinity `4-7` because this Pimox is pinned to Debian Bullseye -on an Orange Pi 5 Plus. Jeannie launches the generated KVM command under that -host CPU set so PSCI can bring both guest CPUs online; it removes legacy `args` -entries so native `qm` CPU topology is the only `-smp` argument. Set -`LAB_PIMOX_KVM_CPUSET=` to use normal `qm start` on a different host. The NVMe -that was previously attached to the Orange Pi now belongs to the HP Debian -laptop as LVM volume group `data-vg`; the current Orange Pi SSD-backed Pimox -datastore is `opi5_ssd` and is used for rebuildable VM root disks. Details and +8 GiB-memory worker VMs starting at VMID `9010`, worker clone storage +`opi5_ssd`, 30 GiB template/control-plane/worker root disks, and KVM launch +affinity `4-7` because this Pimox is pinned to Debian Bullseye on an Orange Pi +5 Plus. Jeannie launches the generated KVM command under that host CPU set so +PSCI can bring both guest CPUs online; it removes legacy `args` entries so +native `qm` CPU topology is the only `-smp` argument. Set +`LAB_PIMOX_KVM_CPUSET=` to use normal `qm start` on a different host. Override +disk sizing with `LAB_PIMOX_TEMPLATE_DISK_GIB`, +`LAB_PIMOX_CONTROL_PLANE_DISK_GIB`, and `LAB_PIMOX_WORKER_DISK_GIB`; Jeannie +installs `cloud-guest-utils`, `e2fsprogs`, and `cri-tools`, resizes the Pimox +disk, and grows the guest root filesystem during the pipeline. The NVMe that +was previously attached to the Orange Pi now belongs to the HP Debian laptop as +LVM volume group `data-vg`; the current Orange Pi SSD-backed Pimox datastore is +`opi5_ssd` and is used for rebuildable VM root disks. Details and override variables are in `bootstrap/provisioning/README.md`. @@ -1926,12 +1937,12 @@ Run a full cluster rebuild from the Debian server with: ./jeannie rebuild-cluster ``` -That path preserves external Gitea, rebuilds the Pimox template -with 2 cores and 8 GiB memory, replaces two Pimox worker VMs with 2 cores and -8 GiB memory, and joins those workers to the Kubernetes cluster. Pimox 7 ARM -does not support `qm --affinity`; Jeannie instead starts the generated KVM -command under CPU set `4-7` and verifies every worker reports two guest CPUs -before Kubernetes workloads proceed. +That path preserves external Gitea, rebuilds the Pimox template with 2 cores, +8 GiB memory, and a 30 GiB default root disk, replaces two Pimox worker VMs with +2 cores, 8 GiB memory, and 30 GiB root disks, and joins those workers to the +Kubernetes cluster. Pimox 7 ARM does not support `qm --affinity`; Jeannie +instead starts the generated KVM command under CPU set `4-7` and verifies every +worker reports two guest CPUs before Kubernetes workloads proceed. The Raspberry Pi is still included as a Kubernetes worker by default; `nuke` does not clean it unless you explicitly add it to `WORKER_SSH_TARGETS`. @@ -2896,15 +2907,20 @@ For Pimox on Orange Pi 5 Plus, `./jeannie up` can create the Debian 13 arm64 template and worker VM clones automatically when the Orange Pi storage path is healthy. Defaults are intentionally tied to the observed host: Pimox SSH host `192.168.100.80`, bridge `vmbr0`, template VMID `9000` on `local` storage, two -8 GiB worker VMs starting at VMID `9010`, worker clone storage `opi5_ssd`, -and KVM launch affinity `4-7` because this Pimox is pinned to Debian Bullseye -on an Orange Pi 5 Plus. Jeannie launches the generated KVM command under that -host CPU set so PSCI can bring both guest CPUs online; it removes legacy `args` -entries so native `qm` CPU topology is the only `-smp` argument. Set -`LAB_PIMOX_KVM_CPUSET=` to use normal `qm start` on a different host. The NVMe -that was previously attached to the Orange Pi now belongs to the HP Debian -laptop as LVM volume group `data-vg`; the current Orange Pi SSD-backed Pimox -datastore is `opi5_ssd` and is used for rebuildable VM root disks. Details and +8 GiB-memory worker VMs starting at VMID `9010`, worker clone storage +`opi5_ssd`, 30 GiB template/control-plane/worker root disks, and KVM launch +affinity `4-7` because this Pimox is pinned to Debian Bullseye on an Orange Pi +5 Plus. Jeannie launches the generated KVM command under that host CPU set so +PSCI can bring both guest CPUs online; it removes legacy `args` entries so +native `qm` CPU topology is the only `-smp` argument. Set +`LAB_PIMOX_KVM_CPUSET=` to use normal `qm start` on a different host. Override +disk sizing with `LAB_PIMOX_TEMPLATE_DISK_GIB`, +`LAB_PIMOX_CONTROL_PLANE_DISK_GIB`, and `LAB_PIMOX_WORKER_DISK_GIB`; Jeannie +installs `cloud-guest-utils`, `e2fsprogs`, and `cri-tools`, resizes the Pimox +disk, and grows the guest root filesystem during the pipeline. The NVMe that +was previously attached to the Orange Pi now belongs to the HP Debian laptop as +LVM volume group `data-vg`; the current Orange Pi SSD-backed Pimox datastore is +`opi5_ssd` and is used for rebuildable VM root disks. Details and override variables are in `bootstrap/provisioning/README.md`. @@ -2965,12 +2981,12 @@ Run a full cluster rebuild from the Debian server with: ./jeannie rebuild-cluster ``` -That path preserves external Gitea, rebuilds the Pimox template -with 2 cores and 8 GiB memory, replaces two Pimox worker VMs with 2 cores and -8 GiB memory, and joins those workers to the Kubernetes cluster. Pimox 7 ARM -does not support `qm --affinity`; Jeannie instead starts the generated KVM -command under CPU set `4-7` and verifies every worker reports two guest CPUs -before Kubernetes workloads proceed. +That path preserves external Gitea, rebuilds the Pimox template with 2 cores, +8 GiB memory, and a 30 GiB default root disk, replaces two Pimox worker VMs with +2 cores, 8 GiB memory, and 30 GiB root disks, and joins those workers to the +Kubernetes cluster. Pimox 7 ARM does not support `qm --affinity`; Jeannie +instead starts the generated KVM command under CPU set `4-7` and verifies every +worker reports two guest CPUs before Kubernetes workloads proceed. The Raspberry Pi is still included as a Kubernetes worker by default; `nuke` does not clean it unless you explicitly add it to `WORKER_SSH_TARGETS`. diff --git a/docs/templates/deployment.md.tmpl b/docs/templates/deployment.md.tmpl index 14b61d9..fdff727 100644 --- a/docs/templates/deployment.md.tmpl +++ b/docs/templates/deployment.md.tmpl @@ -317,9 +317,10 @@ Set `LAB_PIMOX_PIPELINE=false` to skip Pimox automation. Set keeps the template on its configured `local` storage, creates new worker VM clones on `opi5_ssd` by default when that Pimox storage is available, checks that the Pimox bridge already exists, refuses `local` as worker clone -storage, and refuses to edit Orange Pi host networking. Keep durable data on -the HP Debian laptop's `data-vg` or external backups; treat Orange Pi VM disks -as rebuildable worker capacity. +storage, grows existing Pimox guest root filesystems to the configured profile +size, and refuses to edit Orange Pi host networking. Keep durable data on the HP +Debian laptop's `data-vg` or external backups; treat Orange Pi VM disks as +rebuildable worker capacity. `LAB_PIMOX_SKIP_WORKER_INDEXES` defaults to an empty value, so the pipeline owns worker index `1` and VMID `9010` when `LAB_PIMOX_WORKER_COUNT=1`. Set @@ -689,16 +690,21 @@ For Pimox on Orange Pi 5 Plus, `./{{ main_script }} up` can create the Debian 13 template and worker VM clones automatically when the Orange Pi storage path is healthy. Defaults are intentionally tied to the observed host: Pimox SSH host `192.168.100.80`, bridge `vmbr0`, template VMID `9000` on `local` storage, two -8 GiB worker VMs starting at VMID `9010`, worker clone storage `opi5_ssd`, -and KVM launch affinity `4-7` because this Pimox is pinned to Debian Bullseye -on an Orange Pi 5 Plus. Jeannie launches the generated KVM command under that -host CPU set so PSCI can bring both guest CPUs online; it removes legacy `args` -entries so native `qm` CPU topology is the only `-smp` argument. Set -`LAB_PIMOX_KVM_CPUSET=` to use normal `qm start` on a different host. The NVMe -that was previously attached to the Orange Pi now belongs to the HP Debian -laptop as LVM volume group `data-vg`; the current Orange Pi SSD-backed Pimox -datastore is `opi5_ssd` and is used for rebuildable VM root disks. Details and -override variables are in +8 GiB-memory worker VMs starting at VMID `9010`, worker clone storage +`opi5_ssd`, 30 GiB template/control-plane/worker root disks, and KVM launch +affinity `4-7` because this Pimox is pinned to Debian Bullseye on an Orange Pi +5 Plus. Jeannie launches the generated KVM command under that host CPU set so +PSCI can bring both guest CPUs online; it removes legacy `args` entries so +native `qm` CPU topology is the only `-smp` argument. Set +`LAB_PIMOX_KVM_CPUSET=` to use normal `qm start` on a different host. Override +disk sizing with `LAB_PIMOX_TEMPLATE_DISK_GIB`, +`LAB_PIMOX_CONTROL_PLANE_DISK_GIB`, and `LAB_PIMOX_WORKER_DISK_GIB`; Jeannie +installs `cloud-guest-utils`, `e2fsprogs`, and `cri-tools`, resizes the Pimox +disk, and grows the guest root filesystem during the pipeline. The NVMe that +was previously attached to the Orange Pi now belongs to the HP Debian laptop as +LVM volume group `data-vg`; the current Orange Pi SSD-backed Pimox datastore is +`opi5_ssd` and is used for rebuildable VM root disks. Details and override +variables are in `bootstrap/provisioning/README.md`. Worker indexes are stable. Index `1` maps to VMID `9010`, node name @@ -758,12 +764,12 @@ Run a full cluster rebuild from the Debian server with: ./{{ main_script }} rebuild-cluster ``` -That path preserves external Gitea, rebuilds the Pimox template -with 2 cores and 8 GiB memory, replaces two Pimox worker VMs with 2 cores and -8 GiB memory, and joins those workers to the Kubernetes cluster. Pimox 7 ARM -does not support `qm --affinity`; Jeannie instead starts the generated KVM -command under CPU set `4-7` and verifies every worker reports two guest CPUs -before Kubernetes workloads proceed. +That path preserves external Gitea, rebuilds the Pimox template with 2 cores, +8 GiB memory, and a 30 GiB default root disk, replaces two Pimox worker VMs with +2 cores, 8 GiB memory, and 30 GiB root disks, and joins those workers to the +Kubernetes cluster. Pimox 7 ARM does not support `qm --affinity`; Jeannie +instead starts the generated KVM command under CPU set `4-7` and verifies every +worker reports two guest CPUs before Kubernetes workloads proceed. The Raspberry Pi is still included as a Kubernetes worker by default; `nuke` does not clean it unless you explicitly add it to `WORKER_SSH_TARGETS`. @@ -1857,15 +1863,20 @@ For Pimox on Orange Pi 5 Plus, `./{{ main_script }} up` can create the Debian 13 template and worker VM clones automatically when the Orange Pi storage path is healthy. Defaults are intentionally tied to the observed host: Pimox SSH host `192.168.100.80`, bridge `vmbr0`, template VMID `9000` on `local` storage, two -8 GiB worker VMs starting at VMID `9010`, worker clone storage `opi5_ssd`, -and KVM launch affinity `4-7` because this Pimox is pinned to Debian Bullseye -on an Orange Pi 5 Plus. Jeannie launches the generated KVM command under that -host CPU set so PSCI can bring both guest CPUs online; it removes legacy `args` -entries so native `qm` CPU topology is the only `-smp` argument. Set -`LAB_PIMOX_KVM_CPUSET=` to use normal `qm start` on a different host. The NVMe -that was previously attached to the Orange Pi now belongs to the HP Debian -laptop as LVM volume group `data-vg`; the current Orange Pi SSD-backed Pimox -datastore is `opi5_ssd` and is used for rebuildable VM root disks. Details and +8 GiB-memory worker VMs starting at VMID `9010`, worker clone storage +`opi5_ssd`, 30 GiB template/control-plane/worker root disks, and KVM launch +affinity `4-7` because this Pimox is pinned to Debian Bullseye on an Orange Pi +5 Plus. Jeannie launches the generated KVM command under that host CPU set so +PSCI can bring both guest CPUs online; it removes legacy `args` entries so +native `qm` CPU topology is the only `-smp` argument. Set +`LAB_PIMOX_KVM_CPUSET=` to use normal `qm start` on a different host. Override +disk sizing with `LAB_PIMOX_TEMPLATE_DISK_GIB`, +`LAB_PIMOX_CONTROL_PLANE_DISK_GIB`, and `LAB_PIMOX_WORKER_DISK_GIB`; Jeannie +installs `cloud-guest-utils`, `e2fsprogs`, and `cri-tools`, resizes the Pimox +disk, and grows the guest root filesystem during the pipeline. The NVMe that +was previously attached to the Orange Pi now belongs to the HP Debian laptop as +LVM volume group `data-vg`; the current Orange Pi SSD-backed Pimox datastore is +`opi5_ssd` and is used for rebuildable VM root disks. Details and override variables are in `bootstrap/provisioning/README.md`. @@ -1926,12 +1937,12 @@ Run a full cluster rebuild from the Debian server with: ./{{ main_script }} rebuild-cluster ``` -That path preserves external Gitea, rebuilds the Pimox template -with 2 cores and 8 GiB memory, replaces two Pimox worker VMs with 2 cores and -8 GiB memory, and joins those workers to the Kubernetes cluster. Pimox 7 ARM -does not support `qm --affinity`; Jeannie instead starts the generated KVM -command under CPU set `4-7` and verifies every worker reports two guest CPUs -before Kubernetes workloads proceed. +That path preserves external Gitea, rebuilds the Pimox template with 2 cores, +8 GiB memory, and a 30 GiB default root disk, replaces two Pimox worker VMs with +2 cores, 8 GiB memory, and 30 GiB root disks, and joins those workers to the +Kubernetes cluster. Pimox 7 ARM does not support `qm --affinity`; Jeannie +instead starts the generated KVM command under CPU set `4-7` and verifies every +worker reports two guest CPUs before Kubernetes workloads proceed. The Raspberry Pi is still included as a Kubernetes worker by default; `nuke` does not clean it unless you explicitly add it to `WORKER_SSH_TARGETS`. @@ -2896,15 +2907,20 @@ For Pimox on Orange Pi 5 Plus, `./{{ main_script }} up` can create the Debian 13 template and worker VM clones automatically when the Orange Pi storage path is healthy. Defaults are intentionally tied to the observed host: Pimox SSH host `192.168.100.80`, bridge `vmbr0`, template VMID `9000` on `local` storage, two -8 GiB worker VMs starting at VMID `9010`, worker clone storage `opi5_ssd`, -and KVM launch affinity `4-7` because this Pimox is pinned to Debian Bullseye -on an Orange Pi 5 Plus. Jeannie launches the generated KVM command under that -host CPU set so PSCI can bring both guest CPUs online; it removes legacy `args` -entries so native `qm` CPU topology is the only `-smp` argument. Set -`LAB_PIMOX_KVM_CPUSET=` to use normal `qm start` on a different host. The NVMe -that was previously attached to the Orange Pi now belongs to the HP Debian -laptop as LVM volume group `data-vg`; the current Orange Pi SSD-backed Pimox -datastore is `opi5_ssd` and is used for rebuildable VM root disks. Details and +8 GiB-memory worker VMs starting at VMID `9010`, worker clone storage +`opi5_ssd`, 30 GiB template/control-plane/worker root disks, and KVM launch +affinity `4-7` because this Pimox is pinned to Debian Bullseye on an Orange Pi +5 Plus. Jeannie launches the generated KVM command under that host CPU set so +PSCI can bring both guest CPUs online; it removes legacy `args` entries so +native `qm` CPU topology is the only `-smp` argument. Set +`LAB_PIMOX_KVM_CPUSET=` to use normal `qm start` on a different host. Override +disk sizing with `LAB_PIMOX_TEMPLATE_DISK_GIB`, +`LAB_PIMOX_CONTROL_PLANE_DISK_GIB`, and `LAB_PIMOX_WORKER_DISK_GIB`; Jeannie +installs `cloud-guest-utils`, `e2fsprogs`, and `cri-tools`, resizes the Pimox +disk, and grows the guest root filesystem during the pipeline. The NVMe that +was previously attached to the Orange Pi now belongs to the HP Debian laptop as +LVM volume group `data-vg`; the current Orange Pi SSD-backed Pimox datastore is +`opi5_ssd` and is used for rebuildable VM root disks. Details and override variables are in `bootstrap/provisioning/README.md`. @@ -2965,12 +2981,12 @@ Run a full cluster rebuild from the Debian server with: ./{{ main_script }} rebuild-cluster ``` -That path preserves external Gitea, rebuilds the Pimox template -with 2 cores and 8 GiB memory, replaces two Pimox worker VMs with 2 cores and -8 GiB memory, and joins those workers to the Kubernetes cluster. Pimox 7 ARM -does not support `qm --affinity`; Jeannie instead starts the generated KVM -command under CPU set `4-7` and verifies every worker reports two guest CPUs -before Kubernetes workloads proceed. +That path preserves external Gitea, rebuilds the Pimox template with 2 cores, +8 GiB memory, and a 30 GiB default root disk, replaces two Pimox worker VMs with +2 cores, 8 GiB memory, and 30 GiB root disks, and joins those workers to the +Kubernetes cluster. Pimox 7 ARM does not support `qm --affinity`; Jeannie +instead starts the generated KVM command under CPU set `4-7` and verifies every +worker reports two guest CPUs before Kubernetes workloads proceed. The Raspberry Pi is still included as a Kubernetes worker by default; `nuke` does not clean it unless you explicitly add it to `WORKER_SSH_TARGETS`. diff --git a/lib/jeannie/pipeline.sh b/lib/jeannie/pipeline.sh index 5b1caa3..f74f0a9 100644 --- a/lib/jeannie/pipeline.sh +++ b/lib/jeannie/pipeline.sh @@ -2221,6 +2221,77 @@ pimox_guest_cpu_count() { 'nproc --all' } +ensure_pimox_guest_root_disk_size() { + local pimox_host="$1" + local pimox_user="$2" + local pimox_key="$3" + local vmid="$4" + local qm_bin="$5" + local guest_ip="$6" + local guest_user="$7" + local guest_key_path="$8" + local desired_gib="$9" + local description="${10}" + local known_hosts_file="${REPO_ROOT}/.lab/pimox-worker-known_hosts" + local current_gib + + if ! [[ "${desired_gib}" =~ ^[0-9]+$ ]] || ((desired_gib <= 0)); then + echo "Desired Pimox guest disk size must be a positive integer GiB value; got '${desired_gib}'." >&2 + exit 1 + fi + + current_gib="$(pimox_ssh "${pimox_host}" "${pimox_user}" "${pimox_key}" "sudo '${qm_bin}' config '${vmid}' | awk -F'size=' '/^scsi0:/ { split(\$2, a, /[,G]/); print a[1]; exit }'" 2>/dev/null || true)" + if [[ "${current_gib}" =~ ^[0-9]+$ ]] && ((current_gib < desired_gib)); then + echo "Resizing ${description} scsi0 from ${current_gib}G to ${desired_gib}G..." + pimox_ssh "${pimox_host}" "${pimox_user}" "${pimox_key}" "sudo '${qm_bin}' resize '${vmid}' scsi0 '${desired_gib}G'" + elif [[ -z "${current_gib}" ]]; then + echo "Could not read ${description} scsi0 size; continuing with guest filesystem growth check." >&2 + fi + + ssh -i "${guest_key_path}" \ + -o BatchMode=yes \ + -o ConnectTimeout=10 \ + -o IdentitiesOnly=yes \ + -o StrictHostKeyChecking=accept-new \ + -o UserKnownHostsFile="${known_hosts_file}" \ + "${guest_user}@${guest_ip}" \ + "set -eu +if ! command -v growpart >/dev/null 2>&1 || ! command -v crictl >/dev/null 2>&1; then + sudo apt-get update + sudo apt-get install -y --no-install-recommends cloud-guest-utils e2fsprogs cri-tools +fi +root_source=\"\$(findmnt -no SOURCE /)\" +root_fstype=\"\$(findmnt -no FSTYPE /)\" +part_num=\"\$(printf '%s' \"\$root_source\" | sed -n 's/.*[^0-9]\\([0-9][0-9]*\\)$/\\1/p')\" +if [ -z \"\$part_num\" ]; then + echo \"Could not detect root partition number from \$root_source\" >&2 + exit 1 +fi +case \"\$root_source\" in + *p\"\$part_num\") disk=\"\${root_source%p\$part_num}\" ;; + *) disk=\"\${root_source%\$part_num}\" ;; +esac +sudo growpart \"\$disk\" \"\$part_num\" || true +case \"\$root_fstype\" in + ext2|ext3|ext4) + sudo resize2fs \"\$root_source\" + ;; + xfs) + if ! command -v xfs_growfs >/dev/null 2>&1; then + sudo apt-get update + sudo apt-get install -y --no-install-recommends xfsprogs + fi + sudo xfs_growfs / + ;; + *) + echo \"Unsupported root filesystem type \$root_fstype for automatic online grow.\" >&2 + exit 1 + ;; +esac +df -h / +crictl --version || true" +} + ensure_pimox_worker_node() { local index="$1" local spec_file="$2" @@ -2245,6 +2316,7 @@ ensure_pimox_worker_node() { local worker_cpu_affinity="${21}" local worker_kvm_cpuset="${22}" local worker_hookscript_ref="${23}" + local worker_disk_gib="${24}" local worker_network_mode="${LAB_PIMOX_WORKER_NETWORK_MODE:-static}" local worker_static_ips="${LAB_PIMOX_WORKER_STATIC_IPS:-192.168.100.66 192.168.100.67 192.168.100.76}" local worker_gateway="${LAB_PIMOX_WORKER_GATEWAY:-192.168.100.1}" @@ -2451,6 +2523,18 @@ sudo '${qm_bin}' set '${vmid}' --onboot 1" exit 1 fi + ensure_pimox_guest_root_disk_size \ + "${pimox_host}" \ + "${pimox_user}" \ + "${pimox_key}" \ + "${vmid}" \ + "${qm_bin}" \ + "${guest_ip}" \ + "${worker_user}" \ + "${worker_key_path}" \ + "${worker_disk_gib}" \ + "Pimox worker VM ${vmid} (${worker_name})" + guest_cpu_count="$(pimox_guest_cpu_count "${guest_ip}" "${worker_user}" "${worker_key_path}" 2>/dev/null || true)" if ! [[ "${guest_cpu_count}" =~ ^[0-9]+$ ]] || ((guest_cpu_count < worker_cores)); then echo "Pimox worker VM ${vmid} (${worker_name}) reports ${guest_cpu_count:-unknown} CPU(s); restarting through the pinned KVM launch path." >&2 @@ -2492,6 +2576,7 @@ ensure_pimox_control_plane_node() { local cpu_affinity="${18}" local kvm_cpuset="${19}" local hookscript_ref="${20}" + local disk_gib="${21}" local network_mode="${LAB_PIMOX_CONTROL_PLANE_NETWORK_MODE:-${LAB_PIMOX_WORKER_NETWORK_MODE:-static}}" local gateway="${LAB_PIMOX_CONTROL_PLANE_GATEWAY:-${LAB_PIMOX_WORKER_GATEWAY:-192.168.100.1}}" local dns_servers="${LAB_PIMOX_CONTROL_PLANE_DNS_SERVERS:-${LAB_PIMOX_WORKER_DNS_SERVERS:-192.168.100.89 1.1.1.1}}" @@ -2683,6 +2768,18 @@ sudo '${qm_bin}' set '${vmid}' --onboot 1" exit 1 fi + ensure_pimox_guest_root_disk_size \ + "${pimox_host}" \ + "${pimox_user}" \ + "${pimox_key}" \ + "${vmid}" \ + "${qm_bin}" \ + "${guest_ip}" \ + "${guest_user}" \ + "${guest_key_path}" \ + "${disk_gib}" \ + "Pimox control-plane VM ${vmid} (${vm_name})" + guest_cpu_count="$(pimox_guest_cpu_count "${guest_ip}" "${guest_user}" "${guest_key_path}" 2>/dev/null || true)" if ! [[ "${guest_cpu_count}" =~ ^[0-9]+$ ]] || ((guest_cpu_count < cores)); then echo "Pimox control-plane VM ${vmid} (${vm_name}) reports ${guest_cpu_count:-unknown} CPU(s); restarting through the pinned KVM launch path." >&2 @@ -3215,6 +3312,7 @@ run_pimox_pipeline() { local template_name="${LAB_PIMOX_TEMPLATE_NAME:-${TF_VAR_pimox_template_name:-debian13-arm64-k8s-template}}" local template_cores="${LAB_PIMOX_TEMPLATE_CORES:-${TF_VAR_pimox_template_cores:-2}}" local template_memory="${LAB_PIMOX_TEMPLATE_MEMORY:-${TF_VAR_pimox_template_memory:-8192}}" + local template_disk_gib="${LAB_PIMOX_TEMPLATE_DISK_GIB:-30}" local template_replace_existing="${LAB_PIMOX_TEMPLATE_REPLACE_EXISTING:-${TF_VAR_pimox_template_replace_existing:-false}}" local provisioning_interface local worker_count="${LAB_PIMOX_WORKER_COUNT:-1}" @@ -3225,6 +3323,7 @@ run_pimox_pipeline() { local worker_skip_indexes="${LAB_PIMOX_SKIP_WORKER_INDEXES:-}" local worker_cores="${LAB_PIMOX_WORKER_CORES:-2}" local worker_memory="${LAB_PIMOX_WORKER_MEMORY:-8192}" + local worker_disk_gib="${LAB_PIMOX_WORKER_DISK_GIB:-30}" local worker_cpu_affinities="${LAB_PIMOX_WORKER_CPU_AFFINITIES:-}" local pimox_kvm_cpuset="${LAB_PIMOX_KVM_CPUSET:-4-7}" local template_kvm_cpuset="${LAB_PIMOX_TEMPLATE_KVM_CPUSET:-${pimox_kvm_cpuset}}" @@ -3242,6 +3341,7 @@ run_pimox_pipeline() { local control_plane_key_path="${LAB_PIMOX_CONTROL_PLANE_SSH_KEY_PATH:-${LAB_CLUSTER_CONTROL_PLANE_SSH_KEY_PATH:-${LAB_PIMOX_WORKER_SSH_KEY_PATH:-/home/jv/.ssh/id_ed25519}}}" local control_plane_cores="${LAB_PIMOX_CONTROL_PLANE_CORES:-2}" local control_plane_memory="${LAB_PIMOX_CONTROL_PLANE_MEMORY:-8192}" + local control_plane_disk_gib="${LAB_PIMOX_CONTROL_PLANE_DISK_GIB:-30}" local control_plane_storage="${LAB_PIMOX_CONTROL_PLANE_STORAGE:-${LAB_CLUSTER_PIMOX_STORAGE:-${LAB_PIMOX_WORKER_STORAGE:-${TF_VAR_pimox_worker_storage:-opi5_ssd}}}}" local control_plane_replace_existing="${LAB_PIMOX_CONTROL_PLANE_REPLACE_EXISTING:-false}" local control_plane_cpu_affinity="${LAB_PIMOX_CONTROL_PLANE_CPU_AFFINITY:-}" @@ -3296,6 +3396,14 @@ run_pimox_pipeline() { echo "Pimox template, control-plane, and worker CPU and memory values must be greater than zero." >&2 exit 1 fi + if ! [[ "${template_disk_gib}" =~ ^[0-9]+$ && "${worker_disk_gib}" =~ ^[0-9]+$ && "${control_plane_disk_gib}" =~ ^[0-9]+$ ]]; then + echo "LAB_PIMOX_TEMPLATE_DISK_GIB, LAB_PIMOX_WORKER_DISK_GIB, and LAB_PIMOX_CONTROL_PLANE_DISK_GIB must be positive integer GiB values." >&2 + exit 1 + fi + if ((template_disk_gib == 0 || worker_disk_gib == 0 || control_plane_disk_gib == 0)); then + echo "Pimox template, control-plane, and worker disk sizes must be greater than zero." >&2 + exit 1 + fi for cpuset_name in template_kvm_cpuset control_plane_kvm_cpuset worker_kvm_cpuset; do cpuset_value="${!cpuset_name}" if [[ -z "${cpuset_value}" ]]; then @@ -3446,6 +3554,7 @@ fi" 2>&1)" export TF_VAR_pimox_template_name="${template_name}" export TF_VAR_pimox_template_cores="${template_cores}" export TF_VAR_pimox_template_memory="${template_memory}" + export TF_VAR_pimox_template_scsi0="${TF_VAR_pimox_template_scsi0:-local:${template_disk_gib}}" export TF_VAR_pimox_template_replace_existing="${template_replace_existing}" export TF_VAR_pimox_template_kvm_cpuset="${template_kvm_cpuset}" export TF_VAR_pimox_template_builder_enabled="${TF_VAR_pimox_template_builder_enabled:-true}" @@ -3462,7 +3571,7 @@ fi" 2>&1)" exit 1 fi pimox_ssh "${pimox_host}" "${pimox_user}" "${pimox_key}" "sudo '${qm_bin}' set '${template_vmid}' --agent enabled=1" - echo "Worker VM clones will be created on Pimox storage ${worker_storage}; template VM ${template_vmid} stays on its configured template storage." + echo "Worker VM clones will be created on Pimox storage ${worker_storage}; template VM ${template_vmid} stays on its configured template storage; guest roots target ${worker_disk_gib}G." if [[ -n "${pin_hookscript_ref}" ]]; then ensure_pimox_pin_hookscript \ @@ -3497,7 +3606,8 @@ fi" 2>&1)" "${control_plane_memory}" \ "${control_plane_cpu_affinity}" \ "${control_plane_kvm_cpuset}" \ - "${pin_hookscript_ref}" + "${pin_hookscript_ref}" \ + "${control_plane_disk_gib}" fi if ((worker_count == 0)); then @@ -3539,7 +3649,8 @@ fi" 2>&1)" "${worker_replace_existing}" \ "${worker_cpu_affinity}" \ "${worker_kvm_cpuset}" \ - "${pin_hookscript_ref}" + "${pin_hookscript_ref}" \ + "${worker_disk_gib}" done write_cluster_worker_var_file "${var_file}" "${REPO_ROOT}/.lab/manual-workers.tsv" "${spec_file}"