Skip to content

Commit

Permalink
test jq
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Chang committed Dec 18, 2024
1 parent b3252ee commit 06bf416
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 32 deletions.
5 changes: 3 additions & 2 deletions dev-infrastructure/scripts/istio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ echo "==========================================================================

ISTIO_NAMESPACE="aks-istio-system"
CURRENT_TAG_REVISION=$(istioctl tag list --istioNamespace "${ISTIO_NAMESPACE}" -o json | jq --arg tag "${TAG}" '.[] | select(.tag == $tag).revision' -r)

CURRENT_VERSION=$(kubectl get pods -n aks-istio-system -o jsonpath="{.items[0].metadata.name}" | grep -oP '(?<=istiod-)[^-]+-[^-]+-[^-]+')
echo "********** Ensure tag ${TAG} exists **************"
if [ -z "$CURRENT_TAG_REVISION" ]; then
echo "Tag ${TAG} does not exist yet. Creating it with version ${CURRENT_VERSION}"
Expand All @@ -81,7 +81,7 @@ echo "********** Istio Upgrade Started with version ${NEWVERSION} **************

istioctl tag set "$TAG" --revision "${NEWVERSION}" --istioNamespace ${ISTIO_NAMESPACE} --overwrite

# Get the namespaces with the label istio.io/rev=$TAG
#Get the namespaces with the label istio.io/rev=$TAG
for namespace in $( kubectl get namespaces --selector=istio.io/rev="$TAG" -o jsonpath='{.items[*].metadata.name}' ); do
for pod in $( kubectl get pods -n "$namespace" -o jsonpath='{.items[*].metadata.name}' ); do
istio_version=$(kubectl get pod "$pod" -n "$namespace" -o jsonpath='{.metadata.annotations.sidecar\.istio\.io/status}' | grep -oP '(?<="revision":")[^"]*')
Expand Down Expand Up @@ -113,4 +113,5 @@ for namespace in $( kubectl get namespaces --selector=istio.io/rev="$TAG" -o jso
done
done


echo "********** ISTIO Upgrade Finished**************"
58 changes: 28 additions & 30 deletions dev-infrastructure/svc-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,36 @@ resourceGroups:
subscription: {{ .svc.subscription }}
aksCluster: {{ .aksName }}
steps:
- name: svc-infra
action: ARM
template: templates/svc-infra.bicep
parameters: configurations/svc-infra.tmpl.bicepparam
- name: svc
action: ARM
template: templates/svc-cluster.bicep
parameters: configurations/svc-cluster.tmpl.bicepparam
dependsOn:
- svc-infra
- name: enable-metrics
action: Shell
command: scripts/enable-aks-metrics.sh
variables:
- name: RESOURCEGROUP
configRef: svc.rg
- name: AKS_NAME
configRef: aksName
- name: GRAFANA_RESOURCEGROUP
configRef: regionRG
- name: MONITORING_WORKSPACE_NAME
configRef: monitoring.workspaceName
- name: GRAFANA_NAME
configRef: monitoring.grafanaName
dependsOn:
- svc
# - name: svc-infra
# action: ARM
# template: templates/svc-infra.bicep
# parameters: configurations/svc-infra.tmpl.bicepparam
# - name: svc
# action: ARM
# template: templates/svc-cluster.bicep
# parameters: configurations/svc-cluster.tmpl.bicepparam
# dependsOn:
# - svc-infra
# - name: enable-metrics
# action: Shell
# command: scripts/enable-aks-metrics.sh
# variables:
# - name: RESOURCEGROUP
# configRef: svc.rg
# - name: AKS_NAME
# configRef: aksName
# - name: GRAFANA_RESOURCEGROUP
# configRef: regionRG
# - name: MONITORING_WORKSPACE_NAME
# configRef: monitoring.workspaceName
# - name: GRAFANA_NAME
# configRef: monitoring.grafanaName
# dependsOn:
# - svc
- name: istio
action: Shell
command: scripts/istio.sh
variables:
- name: CURRENT_VERSION
configRef: svc.istio.version
- name: TARGET_VERSION
configRef: svc.istio.targetVersion
- name: ISTIOCTL_VERSION
Expand All @@ -46,5 +44,5 @@ resourceGroups:
configRef: svc.istio.url
- name: TAG
configRef: svc.istio.tag
dependsOn:
- enable-metrics
# dependsOn:
# - enable-metrics

0 comments on commit 06bf416

Please sign in to comment.