fix: verify app rollouts after image updates
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

This commit is contained in:
juvenal.diaz 2026-10-05 13:52:09 -06:00
parent ec2f107f76
commit 505bb37971
1 changed files with 32 additions and 1 deletions

View File

@ -4641,6 +4641,13 @@ wait_for_deployment_ready() {
desired_replicas="$(kubectl --kubeconfig "${KUBECONFIG_PATH}" -n "${namespace}" get deployment "${deployment}" -o jsonpath='{.spec.replicas}' 2>/dev/null || true)"
desired_replicas="${desired_replicas:-1}"
if ! kubectl --kubeconfig "${KUBECONFIG_PATH}" -n "${namespace}" rollout status "deployment/${deployment}" --timeout="${timeout_seconds}s"; then
echo "Timed out waiting for deployment/${deployment} rollout in namespace ${namespace}" >&2
dump_argocd_debug "${app}"
dump_namespace_debug "${namespace}"
exit 1
fi
until ready_replicas="$(kubectl --kubeconfig "${KUBECONFIG_PATH}" -n "${namespace}" get deployment "${deployment}" -o jsonpath='{.status.readyReplicas}' 2>/dev/null)"; \
(( ${ready_replicas:-0} >= desired_replicas )); do
if ((elapsed >= timeout_seconds)); then
@ -4654,6 +4661,27 @@ wait_for_deployment_ready() {
done
}
cleanup_disabled_deployment_pods() {
local namespace="$1"
local deployment="$2"
local selector="$3"
local app="$4"
local desired_replicas
desired_replicas="$(kubectl --kubeconfig "${KUBECONFIG_PATH}" -n "${namespace}" get deployment "${deployment}" -o jsonpath='{.spec.replicas}' 2>/dev/null || true)"
if [[ "${desired_replicas:-0}" != "0" ]]; then
return 0
fi
echo "Cleaning up stale pods for disabled deployment/${deployment} in namespace ${namespace}."
if ! kubectl --kubeconfig "${KUBECONFIG_PATH}" -n "${namespace}" delete pod -l "${selector}" --ignore-not-found --wait=true --timeout=120s; then
echo "Failed to clean up stale pods for deployment/${deployment} in namespace ${namespace}" >&2
dump_argocd_debug "${app}"
dump_namespace_debug "${namespace}"
exit 1
fi
}
deploy_gitea() {
local mode="${LAB_GITEA_DEPLOY:-true}"
local gitea_host="${LAB_GITEA_HOST:-${LAB_DEBIAN_LAN_IP:-192.168.100.73}}"
@ -6783,7 +6811,10 @@ apps() {
apply_gitea_runner_secret_file
refresh_argocd_application gitea-runner
if [[ "${LAB_CLUSTER_PROFILE:-debian}" == "pimox" ]] && ! truthy "${LAB_APPS_WAIT_GITEA_RUNNER_ON_PIMOX:-false}"; then
echo "Skipping Gitea Kubernetes runner readiness on Pimox; the current runner manifest needs a Docker socket and is tracked as a follow-up."
wait_for_namespace gitea-runner gitea-runner "${app_resource_wait_seconds}"
wait_for_namespaced_resource gitea-runner deployment gitea-runner gitea-runner "${app_resource_wait_seconds}"
cleanup_disabled_deployment_pods gitea-runner gitea-runner app=gitea-runner gitea-runner
echo "Skipping Gitea Kubernetes runner readiness on Pimox; the current runner manifest needs a Docker socket and is kept scaled down."
else
wait_for_namespace gitea-runner gitea-runner "${app_resource_wait_seconds}"
wait_for_namespaced_resource gitea-runner deployment gitea-runner gitea-runner "${app_resource_wait_seconds}"