#!/usr/bin/env bash # T80: Gateway.spec.selector가 실제 워크로드 pod label과 일치해야 listener가 생성된다 set -euo pipefail NS=istio-vt-t80 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" kubectl -n "$NS" wait --for=condition=Ready pod/client --timeout=90s kubectl -n "$NS" rollout status deploy/selectormismatch-gw --timeout=90s echo "### listener count with mismatched selector (expect 0) ###" istioctl proxy-config listener "deploy/selectormismatch-gw.$NS" --port 8080 -o json | jq 'length' kubectl -n "$NS" patch gateway selectormismatch-gw --type merge \ -p '{"spec":{"selector":{"istio":"selectormismatch-gw"}}}' sleep 8 echo "### listener count after selector fixed (expect >=1) ###" istioctl proxy-config listener "deploy/selectormismatch-gw.$NS" --port 8080 -o json | jq 'length'