From 4dfcb44eeb749c1a28ef666494fd6313790a9ba3 Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Mon, 5 Oct 2026 14:04:47 -0600 Subject: [PATCH] fix: recover stale app pods on Pimox --- lib/jeannie/pipeline.sh | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/lib/jeannie/pipeline.sh b/lib/jeannie/pipeline.sh index 576e0da..5b1caa3 100644 --- a/lib/jeannie/pipeline.sh +++ b/lib/jeannie/pipeline.sh @@ -4682,6 +4682,22 @@ cleanup_disabled_deployment_pods() { fi } +scale_down_disabled_deployment() { + local namespace="$1" + local deployment="$2" + local selector="$3" + local app="$4" + + echo "Scaling disabled deployment/${deployment} in namespace ${namespace} to 0 replicas." + if ! kubectl --kubeconfig "${KUBECONFIG_PATH}" -n "${namespace}" scale "deployment/${deployment}" --replicas=0; then + echo "Failed to scale disabled deployment/${deployment} in namespace ${namespace}." >&2 + dump_argocd_debug "${app}" + dump_namespace_debug "${namespace}" + exit 1 + fi + cleanup_disabled_deployment_pods "${namespace}" "${deployment}" "${selector}" "${app}" +} + deploy_gitea() { local mode="${LAB_GITEA_DEPLOY:-true}" local gitea_host="${LAB_GITEA_HOST:-${LAB_DEBIAN_LAN_IP:-192.168.100.73}}" @@ -6705,6 +6721,13 @@ apps() { run_tofu_stack "bootstrap/apps" + if [[ "${LAB_CLUSTER_PROFILE:-debian}" == "pimox" ]] && ! truthy "${LAB_APPS_WAIT_GITEA_RUNNER_ON_PIMOX:-false}"; then + refresh_argocd_application gitea-runner + 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}" + scale_down_disabled_deployment gitea-runner gitea-runner app=gitea-runner gitea-runner + fi + refresh_argocd_application container-registry refresh_argocd_application supply-chain-policy @@ -6773,11 +6796,7 @@ apps() { wait_for_namespace website-production website-production "${app_resource_wait_seconds}" wait_for_namespaced_resource website-production deployment php-website-deployment website-production "${app_resource_wait_seconds}" ensure_deployment_container_image website-production php-website-deployment php-app "${website_image_ref}" website-production - if [[ "${website_image_built}" == "true" ]]; then - recreate_pods_for_selector website-production app=php-website website-production - else - echo "Skipping website pod restart because the image did not change." - fi + recreate_pods_for_selector website-production app=php-website website-production wait_for_deployment_ready website-production php-website-deployment website-production "${app_ready_wait_seconds}" if [[ "${website_image_built}" == "true" ]]; then write_website_image_state "${website_image_state_file}" "${website_source_hash}" "${website_platforms}" "${website_image_ref}" @@ -6787,11 +6806,7 @@ apps() { wait_for_namespace demos-static demos-static "${app_resource_wait_seconds}" wait_for_namespaced_resource demos-static deployment demos-static demos-static "${app_resource_wait_seconds}" ensure_deployment_container_image demos-static demos-static demos-static "${demos_image_ref}" demos-static - if [[ "${demos_image_built}" == "true" ]]; then - recreate_pods_for_selector demos-static app=demos-static demos-static - else - echo "Skipping demos pod restart because the image did not change." - fi + recreate_pods_for_selector demos-static app=demos-static demos-static wait_for_deployment_ready demos-static demos-static demos-static "${app_ready_wait_seconds}" if [[ "${demos_image_built}" == "true" ]]; then write_demos_image_state "${demos_image_state_file}" "${demos_source_hash}" "${demos_platforms}" "${demos_image_ref}" @@ -6813,7 +6828,7 @@ apps() { if [[ "${LAB_CLUSTER_PROFILE:-debian}" == "pimox" ]] && ! truthy "${LAB_APPS_WAIT_GITEA_RUNNER_ON_PIMOX:-false}"; then 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 + scale_down_disabled_deployment 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}"