File tree Expand file tree Collapse file tree 1 file changed +26
-7
lines changed
Expand file tree Collapse file tree 1 file changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -35,11 +35,29 @@ helm upgrade --install sentrius ./sentrius-gcp-chart --namespace ${TENANT} \
3535 --set sentriusagent.image.tag=${SENTRIUS_AGENT_VERSION} || { echo " Failed to deploy Sentrius with Helm" ; exit 1; }
3636
3737
38- KEYCLOAK_IP=$( kubectl get svc sentrius-keycloak -n ${TENANT} -o jsonpath=' {.status.loadBalancer.ingress[0].ip}' )
39- SENTRIUS_IP=$( kubectl get svc sentrius-sentrius -n ${TENANT} -o jsonpath=' {.status.loadBalancer.ingress[0].ip}' )
40- echo $KEYCLOAK_IP
41- # 35.229.32.6
42- echo $SENTRIUS_IP
38+ # Wait for LoadBalancer IPs to be ready
39+ echo " Waiting for LoadBalancer IPs to be assigned..."
40+ RETRIES=30
41+ SLEEP_INTERVAL=10
42+
43+ for (( i= 1 ; i<= RETRIES; i++ )) ; do
44+ KEYCLOAK_IP=$( kubectl get svc sentrius-keycloak -n ${TENANT} -o jsonpath=' {.status.loadBalancer.ingress[0].ip}' 2> /dev/null)
45+ SENTRIUS_IP=$( kubectl get svc sentrius-sentrius -n ${TENANT} -o jsonpath=' {.status.loadBalancer.ingress[0].ip}' 2> /dev/null)
46+
47+ if [[ -n " $KEYCLOAK_IP " && -n " $SENTRIUS_IP " ]]; then
48+ echo " Keycloak IP: $KEYCLOAK_IP "
49+ echo " Sentrius IP: $SENTRIUS_IP "
50+ break
51+ fi
52+
53+ echo " Attempt $i : Waiting for IPs to be assigned..."
54+ sleep $SLEEP_INTERVAL
55+ done
56+
57+ if [[ -z " $KEYCLOAK_IP " || -z " $SENTRIUS_IP " ]]; then
58+ echo " Failed to retrieve LoadBalancer IPs after $(( RETRIES * SLEEP_INTERVAL)) seconds."
59+ exit 1
60+ fi
4361
4462# Check if subdomain exists
4563if gcloud dns record-sets list --zone=${ZONE} --name=${TENANT} .sentrius.cloud. | grep -q ${TENANT} .sentrius.cloud.; then
5270 --name=${TENANT} .sentrius.cloud. \
5371 --type=A \
5472 --ttl=300 \
55- $SENTRIUS_IP &&
73+ $SENTRIUS_IP
5674
5775 gcloud dns record-sets transaction add --zone=${ZONE} \
5876 --name=keycloak.${TENANT} .sentrius.cloud. \
5977 --type=A \
6078 --ttl=300 \
61- $KEYCLOAK_IP &&
79+ $KEYCLOAK_IP
80+
6281 gcloud dns record-sets transaction execute --zone=${ZONE}
6382fi
You can’t perform that action at this time.
0 commit comments