diff --git a/dev-infrastructure/configurations/svc-cluster.tmpl.bicepparam b/dev-infrastructure/configurations/svc-cluster.tmpl.bicepparam index 747535c8a9..20f37500b5 100644 --- a/dev-infrastructure/configurations/svc-cluster.tmpl.bicepparam +++ b/dev-infrastructure/configurations/svc-cluster.tmpl.bicepparam @@ -1,7 +1,7 @@ using '../templates/svc-cluster.bicep' param kubernetesVersion = '{{ .kubernetesVersion }}' -param istioVersion = ['{{ .svc.istio.versions }}'] +param istioVersion = {{ .svc.istio.versions }} param vnetAddressPrefix = '{{ .vnetAddressPrefix }}' param subnetPrefix = '{{ .subnetPrefix }}' param podSubnetPrefix = '{{ .podSubnetPrefix }}' diff --git a/dev-infrastructure/scripts/istio.sh b/dev-infrastructure/scripts/istio.sh index 1db52c67c8..f3280604e1 100755 --- a/dev-infrastructure/scripts/istio.sh +++ b/dev-infrastructure/scripts/istio.sh @@ -63,7 +63,7 @@ echo "********** ISTIO Upgrade **************" # Followed this guide for istio upgrade https://learn.microsoft.com/en-us/azure/aks/istio-upgrade # To upgrade or rollback, change the targetVersion to the desire version, and version to the current version. if [[ -z "$TARGET_VERSION" ]]; then - echo "Istio is using Target Version. Exiting script." + echo "Target version is not set, Please set the target version" exit 1 fi @@ -71,8 +71,8 @@ NEWVERSION="$TARGET_VERSION" echo "********** Istio Upgrade Started with version ${NEWVERSION} **************" istioctl tag set "$TAG" --revision "${NEWVERSION}" --istioNamespace ${ISTIO_NAMESPACE} --overwrite - for namespace in $(kubectl get namespaces --selector=istio.io/rev="$TAG" -o jsonpath='{.items[*].metadata.name}'); do + echo "in namespace $namespace" pods="$(kubectl get pods --namespace "${namespace}" -o json)" for pod in $(jq <<<"${pods}" --raw-output --arg NEWVERSION "${NEWVERSION}" '.items[] | select(.metadata.annotations["sidecar.istio.io/status"] | fromjson.revision != $NEWVERSION) | .metadata.name'); do owner_kind=$(jq <<<"${pods}" --raw-output --arg NAME "${pod}" '.items[] | select(.metadata.name == $NAME) | .metadata.ownerReferences[0].kind') @@ -81,13 +81,16 @@ for namespace in $(kubectl get namespaces --selector=istio.io/rev="$TAG" -o json "ReplicaSet") deployment=$(kubectl get replicaset "$owner_name" -n "$namespace" -o jsonpath='{.metadata.ownerReferences[0].name}') if [[ -n "$deployment" ]]; then + echo "in ReplicaSet restart deployment $deployment" kubectl rollout restart deployment "$deployment" -n "$namespace" continue 2 else + echo "in ReplicaSet delete pod $pod" kubectl delete pod "$pod" -n "$namespace" fi ;; "StatefulSet") + echo "in StatefulSet restart deployment $deployment" deployment=$(kubectl get replicaset "$owner_name" -n "$namespace" -o jsonpath='{.metadata.ownerReferences[0].name}') kubectl rollout restart deployment "$deployment" -n "$namespace" continue 2