Skip to content

Commit

Permalink
fix: backward compatibility upgrade postgresql from v0.5.1 to v0.6.0 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Rookie committed Aug 11, 2023
1 parent 225a987 commit 220faec
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions deploy/postgresql/templates/scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,22 @@ data:
fi
}
# Waiting for primary pod information from the DownwardAPI annotation to be available, with a maximum of 5 attempts
attempt=1
max_attempts=10
while [ $attempt -le $max_attempts ] && [ -z "$(cat /kb-podinfo/primary-pod)" ]; do
sleep 3
attempt=$((attempt + 1))
done
if [ -f /kb-podinfo/primary-pod ]; then
# Waiting for primary pod information from the DownwardAPI annotation to be available, with a maximum of 5 attempts
attempt=1
max_attempts=10
while [ $attempt -le $max_attempts ] && [ -z "$(cat /kb-podinfo/primary-pod)" ]; do
sleep 3
attempt=$((attempt + 1))
done
primary=$(cat /kb-podinfo/primary-pod)
echo "DownwardAPI get primary=$primary" >> /home/postgres/pgdata/.kb_set_up.log
echo "KB_POD_NAME=$KB_POD_NAME" >> /home/postgres/pgdata/.kb_set_up.log
else
echo "DownwardAPI get /kb-podinfo/primary-pod is empty" >> /home/postgres/pgdata/.kb_set_up.log
fi
primary=$(cat /kb-podinfo/primary-pod)
echo "DownwardAPI get primary=$primary" >> /home/postgres/pgdata/.kb_set_up.log
echo "KB_POD_NAME=$KB_POD_NAME" >> /home/postgres/pgdata/.kb_set_up.log
if [ ! -z "$primary" ] && [ "$primary" != "$KB_POD_NAME" ]; then
primary_fqdn="$primary.$KB_CLUSTER_NAME-$KB_COMP_NAME-headless.$KB_NAMESPACE.svc"
echo "primary_fqdn=$primary_fqdn" >> /home/postgres/pgdata/.kb_set_up.log
Expand Down

0 comments on commit 220faec

Please sign in to comment.