From 6703b20b5917e8337372250b1372b37477bebb7e Mon Sep 17 00:00:00 2001 From: Celes Renata Date: Tue, 21 Apr 2026 02:42:20 +0000 Subject: [PATCH] fix: wait for infra pods to exist before checking readiness kubectl wait fails immediately with 'no matching resources found' if pods haven't been created yet. Added a poll loop to wait for all 3 infra pods (postgres, redis, minio) to exist before running wait. --- infra/inttest/run_pipeline.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/infra/inttest/run_pipeline.sh b/infra/inttest/run_pipeline.sh index 3ce571b..336b645 100755 --- a/infra/inttest/run_pipeline.sh +++ b/infra/inttest/run_pipeline.sh @@ -285,6 +285,16 @@ envsubst < "$REPO_ROOT/infra/inttest/redis.yaml" | kubectl apply -n "$NAMESPACE" log "Applying minio manifest ..." envsubst < "$REPO_ROOT/infra/inttest/minio.yaml" | kubectl apply -n "$NAMESPACE" -f - +# Wait for pods to be created before checking readiness +log "Waiting for infra pods to be created ..." +for i in $(seq 1 30); do + POD_COUNT=$(kubectl get pods -n "$NAMESPACE" -l 'app in (postgres,redis,minio)' --no-headers 2>/dev/null | wc -l) + if [ "$POD_COUNT" -ge 3 ]; then + break + fi + sleep 2 +done + log "Waiting for postgres readiness ..." if ! kubectl wait --for=condition=ready pod -l app=postgres -n "$NAMESPACE" --timeout=120s; then log "FATAL: PostgreSQL did not become ready"