Skip to content

Commit

Permalink
Merge pull request #540 from IABTechLab/tjm-UID2-3334-delay-container…
Browse files Browse the repository at this point in the history
…-start

Add a delay container start
  • Loading branch information
thomasm-ttd authored May 7, 2024
2 parents 0ec54b6 + a8df7e3 commit 3dbdfe4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scripts/azure-cc/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@
#
# This script must be compatible with Ash (provided in eclipse-temurin Docker image) and Bash

function wait_for_sidecar() {
url="http://169.254.169.254/ping"
delay=1
max_retries=15

while true; do
if wget -q --spider --tries=1 --timeout 5 "$url" > /dev/null; then
echo "side car started"
break
else
echo "side car not started. Retrying in $delay seconds..."
sleep $delay
if [ $delay -gt $max_retries ]; then
echo "side car failed to start"
break
fi
delay=$((delay + 1))
fi
done
}

TMP_FINAL_CONFIG="/tmp/final-config.tmp"

if [ -z "${VAULT_NAME}" ]; then
Expand Down Expand Up @@ -52,6 +73,9 @@ fi

cat $FINAL_CONFIG

# delay the start of the operator until the side car has started correctly
wait_for_sidecar

# -- start operator
echo "-- starting java application"
java \
Expand Down

0 comments on commit 3dbdfe4

Please sign in to comment.