aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/policy/resources/config
diff options
context:
space:
mode:
authorAndreas Geissler <andreas-geissler@telekom.de>2024-12-05 10:34:57 +0100
committerAndreas Geissler <andreas-geissler@telekom.de>2024-12-06 12:44:22 +0100
commit3f2073d8de170b5d6a94fbb665b9c7436c52a4c6 (patch)
tree9b179d685fed19154ab9fcf8f1e54142d47a2902 /kubernetes/policy/resources/config
parentc83b46874cdcda8e14b4bf46c2acbff57c9d6e94 (diff)
[POLICY] Fix DB related issues
- fix MariaDB configuration in PolicyAPI - fix Postgres/MariaDB selection handling - fix Secret definitions for DBs - fix Postgres init script to be compliant to PG version 15+ - smaller linter fixes Issue-ID: POLICY-5166 Change-Id: I7d95d50133eb1e9e1d91991d9fea05331442dea0 Signed-off-by: Andreas Geissler <andreas-geissler@telekom.de>
Diffstat (limited to 'kubernetes/policy/resources/config')
-rw-r--r--kubernetes/policy/resources/config/db-pg.sh7
-rw-r--r--kubernetes/policy/resources/config/db_migrator_policy_init.sh2
2 files changed, 7 insertions, 2 deletions
diff --git a/kubernetes/policy/resources/config/db-pg.sh b/kubernetes/policy/resources/config/db-pg.sh
index 913ccc7728..a7fc088d55 100644
--- a/kubernetes/policy/resources/config/db-pg.sh
+++ b/kubernetes/policy/resources/config/db-pg.sh
@@ -20,10 +20,15 @@
export PGPASSWORD=${PG_ADMIN_PASSWORD};
+echo "Create user ${PG_USER} is created in Host ${PG_HOST}"
psql -h ${PG_HOST} -p ${PG_PORT} -U postgres --command "CREATE USER \"${PG_USER}\" WITH PASSWORD '${PG_USER_PASSWORD}'"
for db in migration pooling policyadmin policyclamp operationshistory clampacm
do
+ echo "Create DB ${db}"
psql -h ${PG_HOST} -p ${PG_PORT} -U postgres --command "CREATE DATABASE ${db};"
+ echo "Grant privileges to DB ${db} for user ${PG_USER}"
psql -h ${PG_HOST} -p ${PG_PORT} -U postgres --command "GRANT ALL PRIVILEGES ON DATABASE ${db} TO \"${PG_USER}\";"
-done \ No newline at end of file
+ echo "Grant privileges to SCHEMA public for user ${PG_USER}"
+ psql -h ${PG_HOST} -p ${PG_PORT} -d ${db} -U postgres --command "GRANT ALL ON SCHEMA public TO \"${PG_USER}\";"
+done
diff --git a/kubernetes/policy/resources/config/db_migrator_policy_init.sh b/kubernetes/policy/resources/config/db_migrator_policy_init.sh
index a1d8fd89ea..32ccbf18d4 100644
--- a/kubernetes/policy/resources/config/db_migrator_policy_init.sh
+++ b/kubernetes/policy/resources/config/db_migrator_policy_init.sh
@@ -31,4 +31,4 @@ for schema in ${SQL_DB}; do
fi
done
-exit $rc \ No newline at end of file
+exit $rc