Skip to content

Commit 31e9cf2

Browse files
committed
Optimize clustersynchro manager create db
Signed-off-by: zhongjun.li <[email protected]>
1 parent 90b2fff commit 31e9cf2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

charts/clusterpedia/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 2.2.0
18+
version: 2.2.1
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/clusterpedia/templates/clustersynchro-manager-deployment.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ spec:
4141
# Load YAML data into a Bash variable
4242
source /opt/scripts/parse-yaml.sh;
4343
create_variables /etc/clusterpedia/storage/internalstorage-config.yaml;
44-
until psql -U ${user} -h ${host} -p ${port} postgres -c "SELECT 1 FROM pg_database WHERE datname = '{{ include "clusterpedia.storage.database" . }}'" | grep -q 1 || psql -U ${user} -h ${host} -p ${port} postgres -c "CREATE DATABASE {{ include "clusterpedia.storage.database" . }} owner ${user} " -c "GRANT ALL PRIVILEGES ON DATABASE {{ include "clusterpedia.storage.database" . }} to ${user} "; do
44+
until psql -U ${user} -h ${host} -p ${port} postgres -c "SELECT 1 FROM pg_database WHERE datname = ${database}" | grep -q 1 || psql -U ${user} -h ${host} -p ${port} postgres -c "CREATE DATABASE ${database} owner ${user} " -c "GRANT ALL PRIVILEGES ON DATABASE ${database} to ${user}"; do
4545
echo waiting for database check && sleep 1;
4646
done;
4747
echo 'DataBase OK ✓'
@@ -51,8 +51,8 @@ spec:
5151
source /opt/scripts/parse-yaml.sh;
5252
create_variables /etc/clusterpedia/storage/internalstorage-config.yaml;
5353
if [ -z $password ]; then password=${DB_PASSWORD}; fi;
54-
until mysql -u${user} -p${password} --host=${host} --port=${port} -e 'CREATE DATABASE IF NOT EXISTS {{ include "clusterpedia.storage.database" . }}'; do
55-
echo waiting for database check && sleep 1;
54+
until mysql -u${user} -p${password} --host=${host} --port=${port} -e "CREATE DATABASE IF NOT EXISTS ${database}"; do
55+
echo waiting for database check && sleep 1;
5656
done;
5757
echo 'DataBase OK ✓'
5858
{{- end }}

0 commit comments

Comments
 (0)