fix: tolerate converged flux reconcile waits
Deploy Cluster / Terraform (push) Successful in 35s
Deploy Cluster / Ansible (push) Successful in 18m9s

This commit is contained in:
2026-05-03 02:57:05 +00:00
parent 3dbba22a6d
commit e1c836aacd
+32
View File
@@ -256,6 +256,10 @@ jobs:
local timeout_seconds="$4" local timeout_seconds="$4"
local elapsed=0 local elapsed=0
local handled local handled
local ready
local healthy
local generation
local observed_generation
while [ "${elapsed}" -lt "${timeout_seconds}" ]; do while [ "${elapsed}" -lt "${timeout_seconds}" ]; do
handled="$(kubectl -n "${namespace}" get "${resource}" -o jsonpath='{.status.lastHandledReconcileAt}' 2>/dev/null || true)" handled="$(kubectl -n "${namespace}" get "${resource}" -o jsonpath='{.status.lastHandledReconcileAt}' 2>/dev/null || true)"
@@ -267,6 +271,18 @@ jobs:
elapsed=$((elapsed + 5)) elapsed=$((elapsed + 5))
done done
ready="$(kubectl -n "${namespace}" get "${resource}" -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' 2>/dev/null || true)"
healthy="$(kubectl -n "${namespace}" get "${resource}" -o jsonpath='{.status.conditions[?(@.type=="Healthy")].status}' 2>/dev/null || true)"
generation="$(kubectl -n "${namespace}" get "${resource}" -o jsonpath='{.metadata.generation}' 2>/dev/null || true)"
observed_generation="$(kubectl -n "${namespace}" get "${resource}" -o jsonpath='{.status.observedGeneration}' 2>/dev/null || true)"
if [ "${ready}" = "True" ] && [ "${observed_generation}" = "${generation}" ]; then
if [ -z "${healthy}" ] || [ "${healthy}" = "True" ]; then
echo "${resource} did not report reconcile ${reconcile_at}, but it is already Ready; continuing"
return 0
fi
fi
echo "Timed out waiting for ${resource} to handle reconcile ${reconcile_at}" >&2 echo "Timed out waiting for ${resource} to handle reconcile ${reconcile_at}" >&2
kubectl -n "${namespace}" describe "${resource}" || true kubectl -n "${namespace}" describe "${resource}" || true
exit 1 exit 1
@@ -603,6 +619,10 @@ jobs:
local timeout_seconds="$4" local timeout_seconds="$4"
local elapsed=0 local elapsed=0
local handled local handled
local ready
local healthy
local generation
local observed_generation
while [ "${elapsed}" -lt "${timeout_seconds}" ]; do while [ "${elapsed}" -lt "${timeout_seconds}" ]; do
handled="$(kubectl -n "${namespace}" get "${resource}" -o jsonpath='{.status.lastHandledReconcileAt}' 2>/dev/null || true)" handled="$(kubectl -n "${namespace}" get "${resource}" -o jsonpath='{.status.lastHandledReconcileAt}' 2>/dev/null || true)"
@@ -614,6 +634,18 @@ jobs:
elapsed=$((elapsed + 5)) elapsed=$((elapsed + 5))
done done
ready="$(kubectl -n "${namespace}" get "${resource}" -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' 2>/dev/null || true)"
healthy="$(kubectl -n "${namespace}" get "${resource}" -o jsonpath='{.status.conditions[?(@.type=="Healthy")].status}' 2>/dev/null || true)"
generation="$(kubectl -n "${namespace}" get "${resource}" -o jsonpath='{.metadata.generation}' 2>/dev/null || true)"
observed_generation="$(kubectl -n "${namespace}" get "${resource}" -o jsonpath='{.status.observedGeneration}' 2>/dev/null || true)"
if [ "${ready}" = "True" ] && [ "${observed_generation}" = "${generation}" ]; then
if [ -z "${healthy}" ] || [ "${healthy}" = "True" ]; then
echo "${resource} did not report reconcile ${reconcile_at}, but it is already Ready; continuing"
return 0
fi
fi
echo "Timed out waiting for ${resource} to handle reconcile ${reconcile_at}" >&2 echo "Timed out waiting for ${resource} to handle reconcile ${reconcile_at}" >&2
kubectl -n "${namespace}" describe "${resource}" || true kubectl -n "${namespace}" describe "${resource}" || true
exit 1 exit 1