4

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?

1
  • Have you managed to find the solution for this? Commented Aug 4, 2021 at 7:30

1 Answer 1

5

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;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.