#!/usr/bin/env bash # T84: 짧은 시간 안의 다수 설정 변경(annotate)이 debounce에 의해 소수의 push로 # 합쳐지는지 검증. pilot_xds_pushes(타입별 합)뿐 아니라, 메시 전체 연결 프록시 수와 # 무관하게 "병합된 push 사이클" 자체를 세는 pilot_debounce_time_count로 직접 확인한다. set -euo pipefail NS="istio-vt-t84" DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PF_PID="" cleanup() { if [[ -n "${PF_PID}" ]]; then kill "${PF_PID}" 2>/dev/null || true fi kubectl delete namespace "${NS}" --wait=false --ignore-not-found } trap cleanup EXIT kubectl create namespace "${NS}" --dry-run=client -o yaml | \ kubectl label -f - istio-injection=enabled --local -o yaml | \ kubectl apply -f - kubectl apply -f "${DIR}/manifest.yaml" kubectl -n "${NS}" wait --for=condition=Ready pod/client --timeout=90s kubectl -n "${NS}" rollout status deploy/echo --timeout=90s kubectl -n istio-system port-forward deploy/istiod 15014:15014 & PF_PID=$! sleep 2 # --- burst 1: as specified by test spec (pilot_xds_pushes, summed across types) --- BEFORE=$(curl -s localhost:15014/metrics | awk '/^pilot_xds_pushes\{/{s+=$NF} END{print s+0}') for i in $(seq 1 10); do kubectl annotate virtualservice echo-debounce-test -n "${NS}" test-burst="$i" --overwrite done sleep 3 AFTER=$(curl -s localhost:15014/metrics | awk '/^pilot_xds_pushes\{/{s+=$NF} END{print s+0}') echo "before=$BEFORE after=$AFTER delta=$((AFTER-BEFORE))" echo "(note: this raw delta scales with mesh-wide connected-proxy count x xds-type" echo " count for a SINGLE merged push, so it is not directly '# of push cycles'.)" # --- burst 2: direct measurement of merged push-cycle count via pilot_debounce_time_count --- BEFORE2=$(curl -s localhost:15014/metrics | awk '/^pilot_debounce_time_count/{print $2+0}') for i in $(seq 1 10); do kubectl annotate virtualservice echo-debounce-test -n "${NS}" test-burst2="$i" --overwrite done sleep 3 AFTER2=$(curl -s localhost:15014/metrics | awk '/^pilot_debounce_time_count/{print $2+0}') echo "debounce_before=$BEFORE2 debounce_after=$AFTER2 delta_debounce_events=$((AFTER2-BEFORE2))" kill "${PF_PID}" 2>/dev/null || true PF_PID=""