perf: speed up first bootstrap with fast-mode defaults #64
@@ -165,6 +165,10 @@ jobs:
|
|||||||
- name: Run cluster rebuild and bootstrap
|
- name: Run cluster rebuild and bootstrap
|
||||||
env:
|
env:
|
||||||
NIX_CONFIG: experimental-features = nix-command flakes
|
NIX_CONFIG: experimental-features = nix-command flakes
|
||||||
|
FAST_MODE: "1"
|
||||||
|
WORKER_PARALLELISM: "3"
|
||||||
|
REBUILD_TIMEOUT: "45m"
|
||||||
|
REBUILD_RETRIES: "2"
|
||||||
run: |
|
run: |
|
||||||
if [ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
if [ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||||
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||||||
|
|||||||
@@ -193,6 +193,10 @@ jobs:
|
|||||||
- name: Rebuild and bootstrap/reconcile kubeadm cluster
|
- name: Rebuild and bootstrap/reconcile kubeadm cluster
|
||||||
env:
|
env:
|
||||||
NIX_CONFIG: experimental-features = nix-command flakes
|
NIX_CONFIG: experimental-features = nix-command flakes
|
||||||
|
FAST_MODE: "1"
|
||||||
|
WORKER_PARALLELISM: "3"
|
||||||
|
REBUILD_TIMEOUT: "45m"
|
||||||
|
REBUILD_RETRIES: "2"
|
||||||
run: |
|
run: |
|
||||||
if [ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
if [ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||||
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||||||
|
|||||||
@@ -108,9 +108,12 @@ $EDITOR ./scripts/inventory.env
|
|||||||
Optional tuning env vars:
|
Optional tuning env vars:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
WORKER_PARALLELISM=2 REBUILD_TIMEOUT=45m REBUILD_RETRIES=2 ./scripts/rebuild-and-bootstrap.sh
|
FAST_MODE=1 WORKER_PARALLELISM=3 REBUILD_TIMEOUT=45m REBUILD_RETRIES=2 ./scripts/rebuild-and-bootstrap.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- `FAST_MODE=1` skips pre-rebuild remote GC cleanup to reduce wall-clock time.
|
||||||
|
- Set `FAST_MODE=0` for a slower but more aggressive space cleanup pass.
|
||||||
|
|
||||||
3. If you only want to reset Kubernetes state on existing VMs:
|
3. If you only want to reset Kubernetes state on existing VMs:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ SSH_OPTS="${SSH_OPTS:--o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChe
|
|||||||
SSH_USER_CANDIDATES="${SSH_USER_CANDIDATES:-root $SSH_USER}"
|
SSH_USER_CANDIDATES="${SSH_USER_CANDIDATES:-root $SSH_USER}"
|
||||||
REBUILD_TIMEOUT="${REBUILD_TIMEOUT:-45m}"
|
REBUILD_TIMEOUT="${REBUILD_TIMEOUT:-45m}"
|
||||||
REBUILD_RETRIES="${REBUILD_RETRIES:-2}"
|
REBUILD_RETRIES="${REBUILD_RETRIES:-2}"
|
||||||
WORKER_PARALLELISM="${WORKER_PARALLELISM:-2}"
|
WORKER_PARALLELISM="${WORKER_PARALLELISM:-3}"
|
||||||
|
FAST_MODE="${FAST_MODE:-1}"
|
||||||
|
|
||||||
declare -A NODE_IPS=()
|
declare -A NODE_IPS=()
|
||||||
declare -a CP_NAMES=()
|
declare -a CP_NAMES=()
|
||||||
@@ -190,14 +191,18 @@ detect_ssh_user "$PRIMARY_CP_IP"
|
|||||||
|
|
||||||
for node in "${CP_NAMES[@]}"; do
|
for node in "${CP_NAMES[@]}"; do
|
||||||
prepare_remote_nix_trust "${NODE_IPS[$node]}"
|
prepare_remote_nix_trust "${NODE_IPS[$node]}"
|
||||||
prepare_remote_space "${NODE_IPS[$node]}"
|
if [ "$FAST_MODE" != "1" ]; then
|
||||||
|
prepare_remote_space "${NODE_IPS[$node]}"
|
||||||
|
fi
|
||||||
rebuild_node_with_retry "$node" "${NODE_IPS[$node]}"
|
rebuild_node_with_retry "$node" "${NODE_IPS[$node]}"
|
||||||
done
|
done
|
||||||
|
|
||||||
worker_failures=0
|
worker_failures=0
|
||||||
for node in "${WK_NAMES[@]}"; do
|
for node in "${WK_NAMES[@]}"; do
|
||||||
prepare_remote_nix_trust "${NODE_IPS[$node]}"
|
prepare_remote_nix_trust "${NODE_IPS[$node]}"
|
||||||
prepare_remote_space "${NODE_IPS[$node]}"
|
if [ "$FAST_MODE" != "1" ]; then
|
||||||
|
prepare_remote_space "${NODE_IPS[$node]}"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
active_jobs=0
|
active_jobs=0
|
||||||
|
|||||||
Reference in New Issue
Block a user