#!/usr/bin/env bash # T83: istio-proxy's 15021/healthz/ready readiness is independent of the app # container's own readinessProbe. set -euo pipefail NS=istio-vt-t83 DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cleanup() { kubectl delete namespace "$NS" --wait=false --ignore-not-found >/dev/null 2>&1 || true } trap cleanup EXIT kubectl create namespace "$NS" kubectl label namespace "$NS" istio-injection=enabled kubectl apply -f "$DIR/manifest.yaml" # client pod has no readiness dependency issue -> should reach 2/2 Ready normally. kubectl -n "$NS" wait --for=condition=Ready pod/client --timeout=120s # readiness-indep-echo's app container (nginx) is deliberately configured so # /health always returns 503 -> its readinessProbe will NEVER succeed, so the # pod will legitimately stay at 1/2 READY forever. We only wait for the pod to # reach phase=Running (not condition=Ready, which would time out by design), # then follow the spec's own "sleep 15" to let a few probe cycles happen. for i in $(seq 1 60); do PHASE=$(kubectl -n "$NS" get pod -l app=readiness-indep-echo -o jsonpath='{.items[0].status.phase}' 2>/dev/null || true) [ "$PHASE" = "Running" ] && break sleep 2 done sleep 15 kubectl -n "$NS" get pod -l app=readiness-indep-echo \ -o jsonpath='{.items[0].status.containerStatuses[*].name}={.items[0].status.containerStatuses[*].ready}{"\n"}' POD=$(kubectl -n "$NS" get pod -l app=readiness-indep-echo -o jsonpath='{.items[0].metadata.name}') kubectl -n "$NS" exec "$POD" -c istio-proxy -- \ curl -s -o /dev/null -w 'istio_proxy_15021=%{http_code}\n' localhost:15021/healthz/ready # extra corroboration kubectl -n "$NS" get pod "$POD" -o jsonpath='{.status.conditions}'; echo kubectl -n "$NS" get pod -l app=readiness-indep-echo -o wide