Skip to content

Commit

Permalink
Optimize clustersynchro manager create db
Browse files Browse the repository at this point in the history
Signed-off-by: zhongjun.li <[email protected]>
  • Loading branch information
learner0810 committed Aug 8, 2024
1 parent 90b2fff commit 31e9cf2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/clusterpedia/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 2.2.0
version: 2.2.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
# Load YAML data into a Bash variable
source /opt/scripts/parse-yaml.sh;
create_variables /etc/clusterpedia/storage/internalstorage-config.yaml;
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
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
echo waiting for database check && sleep 1;
done;
echo 'DataBase OK ✓'
Expand All @@ -51,8 +51,8 @@ spec:
source /opt/scripts/parse-yaml.sh;
create_variables /etc/clusterpedia/storage/internalstorage-config.yaml;
if [ -z $password ]; then password=${DB_PASSWORD}; fi;
until mysql -u${user} -p${password} --host=${host} --port=${port} -e 'CREATE DATABASE IF NOT EXISTS {{ include "clusterpedia.storage.database" . }}'; do
echo waiting for database check && sleep 1;
until mysql -u${user} -p${password} --host=${host} --port=${port} -e "CREATE DATABASE IF NOT EXISTS ${database}"; do
echo waiting for database check && sleep 1;
done;
echo 'DataBase OK ✓'
{{- end }}
Expand Down

0 comments on commit 31e9cf2

Please sign in to comment.