Skip to content

Commit

Permalink
Fix ingress deploy via wait loop for Stage IP (Azure-Samples#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
rguthriemsft authored and dtzar committed Jun 18, 2019
1 parent 46557a3 commit 3af0fc2
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions provision-team/deploy_ingress_dns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ helm install --name team-ingress ./traefik -f traefik-values.yaml --set kubernet
#Staging POD
helm install --name team-ingress-stage ./traefik -f traefik-values.yaml --set kubernetes.endpoint="${APISERVER}",dashboard.domain="stage${DASHBOARD_URL}",service.annotations."service\.beta\.kubernetes\.io/azure-dns-label-name"="stage${DNS_LABEL}" --debug

echo "Waiting for public IP:"
#Wait for Prod IP
echo "Waiting for PROD public IP:"
time=0
while true; do
INGRESS_IP=$(kubectl get svc team-ingress-traefik -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
Expand All @@ -137,6 +138,24 @@ done
INGRESS_IP=$(kubectl get svc team-ingress-traefik -o jsonpath='{.status.loadBalancer.ingress[0].ip}')

DNS_HOSTNAME=akstraefik$teamName.$resourceGroupLocation.cloudapp.azure.com
echo -e "\n\nExternal DNS hostname is https://"$DNS_HOSTNAME "which maps to IP " $INGRESS_IP
echo -e "\n\nExternal PROD DNS hostname is https://"$DNS_HOSTNAME "which maps to IP " $INGRESS_IP

kvstore set ${teamName} ingressIp ${INGRESS_IP}

#Wait for Staging IP
echo "Waiting for Staging public IP:"
time=0
while true; do
STAGE_INGRESS_IP=$(kubectl get svc team-ingress-stage-traefik -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
if [[ "${STAGE_INGRESS_IP}" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then break; fi
sleep 10
time=$(($time+10))
echo $time "seconds waiting"
done

STAGE_INGRESS_IP=$(kubectl get svc team-ingress-stage-traefik -o jsonpath='{.status.loadBalancer.ingress[0].ip}')

STAGE_DNS_HOSTNAME=stageakstraefik$teamName.$resourceGroupLocation.cloudapp.azure.com
echo -e "\n\nExternal STAGING DNS hostname is https://"$STAGE_DNS_HOSTNAME "which maps to IP " $STAGE_INGRESS_IP

kvstore set ${teamName} stageIngressIp ${STAGE_INGRESS_IP}

0 comments on commit 3af0fc2

Please sign in to comment.