Compare commits

...

2 Commits

Author SHA1 Message Date
juvenal.diaz 596e970fb7 Check disabled workloads and planned static volumes correctly
Homelab Main / validate (push) Waiting to run Details
Homelab Main / running-update (push) Blocked by required conditions Details
Homelab Main / debian-ops (push) Blocked by required conditions Details
2026-11-02 21:24:58 -06:00
juvenal.diaz 0859683c40 Stop app deployment when guarded OpenTofu apply fails 2026-11-02 21:20:42 -06:00
2 changed files with 14 additions and 4 deletions

View File

@ -1081,8 +1081,8 @@ run_tofu_stack() {
ensure_platform_scheduling_labels || return 1
fi
tofu -chdir="${REPO_ROOT}/${stack}" init
ensure_kubernetes_api_ready_for_tofu_stack "${stack}"
tofu -chdir="${REPO_ROOT}/${stack}" init || return 1
ensure_kubernetes_api_ready_for_tofu_stack "${stack}" || return 1
if [[ "${stack}" == "bootstrap/platform" ]]; then
configure_platform_metrics_server_ownership || return 1
fi
@ -8167,9 +8167,9 @@ apps() {
echo "Deploying homelab applications..."
if ((${#app_targets[@]})); then
run_tofu_stack "bootstrap/apps" "${app_targets[@]}"
run_tofu_stack "bootstrap/apps" "${app_targets[@]}" || return 1
else
run_tofu_stack "bootstrap/apps"
run_tofu_stack "bootstrap/apps" || return 1
fi
if [[ "${app_selector}" == "all" || "${deploy_registry}" == "true" || "${deploy_supply_chain}" == "true" ]]; then

View File

@ -396,6 +396,12 @@ class Estimate:
old = [p for p in self.pods if self.owner(p) == (kind, namespace, name)]
live = self.controllers.get((kind, namespace, name), {})
desired = spec.get("replicas", 1)
if kind in ("Deployment", "StatefulSet") and desired == 0:
# A disabled workload creates no incoming Pods and does not need
# rollout surge/unavailability or an eligible node. Keep any old
# reservations until live termination is observed.
print(f" DISABLED {kind} {namespace}/{name}: zero desired replicas")
return
status = live.get("status", {})
stable = status.get("observedGeneration", 0) >= live.get("metadata", {}).get("generation", 1)
stable = stable and status.get("readyReplicas", 0) >= desired and status.get("updatedReplicas", 0) >= desired
@ -677,6 +683,10 @@ def main():
if item["kind"] == "PersistentVolumeClaim":
key = item["metadata"]["namespace"], item["metadata"]["name"]
engine.pvcs.setdefault(key, item)
elif item["kind"] == "PersistentVolume":
# Static PVs can be introduced by the same GitOps application as
# their claims. Live PVs remain authoritative for existing data.
engine.pvs.setdefault(item["metadata"]["name"], item)
elif item["kind"] == "StorageClass":
engine.storage_classes[item["metadata"]["name"]] = item
workloads = {identity(d): d for d in documents if d["kind"] in ("Deployment", "StatefulSet", "DaemonSet", "Pod")}