Skip to content

Commit

Permalink
chore(helm): Waiting for postgres to be up
Browse files Browse the repository at this point in the history
Signed-off-by: rjshrjndrn <[email protected]>
  • Loading branch information
rjshrjndrn committed Jun 13, 2024
1 parent 7a95e07 commit 22d1177
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scripts/helmcharts/openreplay/templates/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,27 @@ spec:
git checkout {{ default .Chart.AppVersion .Values.dbMigrationUpstreamBranch }} || exit 10
{{ .Values.global.dbMigrationPreCommand | default "" }}
exit_count=0
error_connection=1
while [ $exit_count -le 20 ];do
nc -zv {{.Values.global.postgresql.postgresqlHost}} {{.Values.global.postgresql.postgresqlPort}} -w 1
if [ $? -ne 0 ]; then
echo "[info] postgresql is not up; retrying in 5 seconds"
sleep 4
exit_count=$(($exit_count+1))
echo $exit_count
else
error_connection=0
break
fi
done
if [ $error_connection -eq 1 ]; then
echo "[error] clickhouse is not running. Check kubectl get po -n db; exiting"
exit 100
fi
# Checking variable is empty. Shell independant method.
if [ "x$ENTERPRISE_EDITION_LICENSE" != "x" ]; then
exit_count=0
Expand Down

0 comments on commit 22d1177

Please sign in to comment.