From d8f64ecde415e5bacb7676379979e0d0066774af Mon Sep 17 00:00:00 2001 From: Jonathan Chang Date: Fri, 20 Dec 2024 14:25:18 -0800 Subject: [PATCH] use target selector to get the number of istio pod --- dev-infrastructure/scripts/istio.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-infrastructure/scripts/istio.sh b/dev-infrastructure/scripts/istio.sh index 1f9671c10..437c68d01 100755 --- a/dev-infrastructure/scripts/istio.sh +++ b/dev-infrastructure/scripts/istio.sh @@ -3,7 +3,7 @@ set -euo pipefail ISTIO_NAMESPACE="aks-istio-system" echo "********** Check istio is up and running **************" -ISTIO_PODS_COUNT=$(kubectl get pods -n ${ISTIO_NAMESPACE} -o jsonpath='{range .items[?(@.status.phase=="Running")]}{.metadata.name}{"\n"}{end}' | grep -c "${TARGET_VERSION}") +ISTIO_PODS_COUNT=$(kubectl get pods -n ${ISTIO_NAMESPACE} -l istio.io/rev="${TARGET_VERSION}" --field-selector=status.phase=Running --no-headers | wc -l) if [[ $ISTIO_PODS_COUNT -lt 2 ]]; then echo "Istio pods are not running, Please check the istio pods" exit 1