chore(helm): Waiting for postgres to be up

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
This commit is contained in:
rjshrjndrn 2024-06-13 13:15:04 +02:00
parent 7a95e071b3
commit 22d1177eef

View file

@ -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