Reputation: 7107
I have the following template:
image:
tag: "13"
postgresqlUsername: postgres
postgresqlPassword: "12345678"
postgresqlDatabase: postgres
initdbScripts:
init: |
CREATE USER my_app WITH PASSWORD '12345678';
CREATE DATABASE my_db;
GRANT ALL PRIVILEGES ON DATABASE my_db TO my_app;
Running helm install postgresql bitnami/postgresql -f conf/postgresql/postgresql.yaml
spins up the deployment with the configmap correctly, but the database "my_db" and the user "my_app" were not created.
I need to use this setup to create multiple databases and users (hence postgresqlDatabase
is not enough).
How should I work with the initdbScripts
or what am I doing wrong?
Upvotes: 4
Views: 4337
Reputation: 12281
The script needs a file extension so it knows how to run.
Add .sql
to init
:
image:
tag: "13"
postgresqlUsername: postgres
postgresqlPassword: "12345678"
postgresqlDatabase: postgres
initdbScripts:
init.sql: | # <-- Here
CREATE USER my_app WITH PASSWORD '12345678';
CREATE DATABASE my_db;
GRANT ALL PRIVILEGES ON DATABASE my_db TO my_app;
Upvotes: 5