Check disabled workloads and planned static volumes correctly
This commit is contained in:
parent
0859683c40
commit
596e970fb7
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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")}
|
||||
|
|
|
|||
Loading…
Reference in New Issue