Skip to content

Commit

Permalink
fix lint and comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Chang committed Dec 18, 2024
1 parent 92c368c commit ca55f45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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 }}'
Expand Down
7 changes: 5 additions & 2 deletions dev-infrastructure/scripts/istio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ 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

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')
Expand All @@ -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
Expand Down

0 comments on commit ca55f45

Please sign in to comment.