Files
homelab/k8s/infrastructure/longhorn/kustomization.yaml
T
Story Crater Bot e76ad914d2 feat(longhorn): auto-expand all volumes to 3 replicas via PostSync hook
Adds expand-replicas-job.yaml: PostSync hook Job that:
- Waits for all 3 Longhorn nodes to be Ready
- Patches every volume with numberOfReplicas < 3 to 3
- Runs idempotently on every longhorn-config sync (BeforeHookCreation
  deletes previous job, so re-runs are safe)

This ensures existing 1-replica volumes (created before the HA setup) get
expanded automatically via GitOps, not via manual kubectl patch.

Why PostSync: needs to run AFTER the taint-toleration setting and Node CRDs
are applied, otherwise there aren't 3 nodes available yet and the expansion
would fail (Longhorn can't create replicas on nodes that don't exist).
2026-07-22 08:50:22 -07:00

15 lines
633 B
YAML

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: longhorn-system
resources:
- longhorn-wffc-storageclass.yaml
- longhorn-servicemonitor.yaml
- longhorn-taint-toleration.yaml
- longhorn-nodes.yaml
- expand-replicas-job.yaml
# Longhorn deployed via bootstrap script (cluster-config/longhorn_bootstrap.sh).
# These manifests configure it post-bootstrap: WFFC StorageClass (default),
# Prometheus ServiceMonitor, taint toleration for control-plane nodes, explicit
# Node CRDs for cp-2/cp-3, and a PostSync hook Job that expands all existing
# volumes from 1→3 replicas (runs after nodes are Ready).