Skip manually created first Pimox worker
This commit is contained in:
parent
391070d440
commit
dfe7bbf4a7
12
README.md
12
README.md
|
|
@ -100,6 +100,13 @@ clones on `nvme_thin_pool` by default, checks that the Pimox bridge already
|
||||||
exists, refuses `local` as worker clone storage, and refuses to edit Orange Pi
|
exists, refuses `local` as worker clone storage, and refuses to edit Orange Pi
|
||||||
host networking.
|
host networking.
|
||||||
|
|
||||||
|
`LAB_PIMOX_SKIP_WORKER_INDEXES` defaults to `1` because the first Pimox worker
|
||||||
|
slot was created manually. With the default `LAB_PIMOX_WORKER_COUNT=1`, the
|
||||||
|
pipeline keeps the template current and leaves VMID `9010` alone. Set
|
||||||
|
`LAB_PIMOX_SKIP_WORKER_INDEXES=''` if you want the pipeline to own the first
|
||||||
|
slot, or set `LAB_PIMOX_WORKER_COUNT=2` to manage the second slot while still
|
||||||
|
skipping the first.
|
||||||
|
|
||||||
OpenWrt firewall VM automation is opt-in because it attaches to both WAN and
|
OpenWrt firewall VM automation is opt-in because it attaches to both WAN and
|
||||||
LAN bridges. Set `LAB_OPENWRT_VM=true` after `vmbr1` already exists on the
|
LAN bridges. Set `LAB_OPENWRT_VM=true` after `vmbr1` already exists on the
|
||||||
Orange Pi. The pipeline downloads the OpenWrt ARM SystemReady EFI image, writes
|
Orange Pi. The pipeline downloads the OpenWrt ARM SystemReady EFI image, writes
|
||||||
|
|
@ -146,6 +153,11 @@ the observed host: Pimox SSH host `192.168.100.80`, bridge `vmbr0`, template VMI
|
||||||
storage `nvme_thin_pool`. Details and override variables are in
|
storage `nvme_thin_pool`. Details and override variables are in
|
||||||
`bootstrap/provisioning/README.md`.
|
`bootstrap/provisioning/README.md`.
|
||||||
|
|
||||||
|
Worker indexes are stable. Index `1` maps to VMID `9010`, node name
|
||||||
|
`pimox-worker-01`, and worker key `pimox01`; index `2` maps to VMID `9011`, and
|
||||||
|
so on. `LAB_PIMOX_SKIP_WORKER_INDEXES=1` leaves the already-created first slot
|
||||||
|
unmanaged while allowing higher indexes to be automated.
|
||||||
|
|
||||||
Add entries to `bootstrap/cluster/variables.tf` or a `.tfvars` file:
|
Add entries to `bootstrap/cluster/variables.tf` or a `.tfvars` file:
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
|
|
|
||||||
26
lab.sh
26
lab.sh
|
|
@ -60,6 +60,26 @@ disabled_value() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
worker_index_is_skipped() {
|
||||||
|
local index="$1"
|
||||||
|
local skip_indexes="$2"
|
||||||
|
local skip_index
|
||||||
|
|
||||||
|
skip_indexes="${skip_indexes//,/ }"
|
||||||
|
for skip_index in ${skip_indexes}; do
|
||||||
|
[[ -z "${skip_index}" ]] && continue
|
||||||
|
if ! [[ "${skip_index}" =~ ^[0-9]+$ ]]; then
|
||||||
|
echo "LAB_PIMOX_SKIP_WORKER_INDEXES must contain only comma or space separated positive integers." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ((skip_index == index)); then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
ensure_python3() {
|
ensure_python3() {
|
||||||
if command -v python3 >/dev/null 2>&1; then
|
if command -v python3 >/dev/null 2>&1; then
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -305,6 +325,7 @@ run_pimox_pipeline() {
|
||||||
local worker_name_prefix="${LAB_PIMOX_WORKER_NAME_PREFIX:-pimox-worker}"
|
local worker_name_prefix="${LAB_PIMOX_WORKER_NAME_PREFIX:-pimox-worker}"
|
||||||
local worker_node_prefix="${LAB_PIMOX_WORKER_NODE_PREFIX:-pimox-worker}"
|
local worker_node_prefix="${LAB_PIMOX_WORKER_NODE_PREFIX:-pimox-worker}"
|
||||||
local worker_key_prefix="${LAB_PIMOX_WORKER_KEY_PREFIX:-pimox}"
|
local worker_key_prefix="${LAB_PIMOX_WORKER_KEY_PREFIX:-pimox}"
|
||||||
|
local worker_skip_indexes="${LAB_PIMOX_SKIP_WORKER_INDEXES:-1}"
|
||||||
local worker_cores="${LAB_PIMOX_WORKER_CORES:-2}"
|
local worker_cores="${LAB_PIMOX_WORKER_CORES:-2}"
|
||||||
local worker_memory="${LAB_PIMOX_WORKER_MEMORY:-2048}"
|
local worker_memory="${LAB_PIMOX_WORKER_MEMORY:-2048}"
|
||||||
local worker_storage="${LAB_PIMOX_WORKER_STORAGE:-${TF_VAR_pimox_worker_storage:-nvme_thin_pool}}"
|
local worker_storage="${LAB_PIMOX_WORKER_STORAGE:-${TF_VAR_pimox_worker_storage:-nvme_thin_pool}}"
|
||||||
|
|
@ -403,6 +424,11 @@ fi" 2>&1)"
|
||||||
mkdir -p "${REPO_ROOT}/.lab"
|
mkdir -p "${REPO_ROOT}/.lab"
|
||||||
: >"${spec_file}"
|
: >"${spec_file}"
|
||||||
for ((index = 1; index <= worker_count; index++)); do
|
for ((index = 1; index <= worker_count; index++)); do
|
||||||
|
if worker_index_is_skipped "${index}" "${worker_skip_indexes}"; then
|
||||||
|
echo "Skipping Pimox worker index ${index} because LAB_PIMOX_SKIP_WORKER_INDEXES=${worker_skip_indexes}."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
ensure_pimox_worker_node \
|
ensure_pimox_worker_node \
|
||||||
"${index}" \
|
"${index}" \
|
||||||
"${spec_file}" \
|
"${spec_file}" \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue