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.
This commit is contained in:
Celes Renata
2026-04-21 02:42:20 +00:00
parent 6e1339d666
commit 6703b20b59
+10
View File
@@ -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"