<p>The default Helm Chart for PostgreSQL (i.e. <code>stable/postgresql</code>) defines an <code>initdbScripts</code> parameter that allows initialization scripts to be run. However, I can't seem to get the format correct on how to issue it via the command line.</p>

<p><strong>Could someone provide an example of how to populate this command line parameter?</strong></p>

<p>Here's what I'm issuing, minus a working version of the <code>initdbScripts</code> parameter.</p>

<pre><code>helm install stable/postgresql -n testpg \
    --set global.postgresql.postgresqlDatabase=testpg \
    --set global.postgresql.postgresqlUsername=testpg \
    --set global.postgresql.postgresqlPassword=testpg \
    --set global.postgresql.servicePort=5432 \
    --set initdbScripts=(WHAT GOES HERE TO RUN "sql/init.sql"??) \
    --set service.type=LoadBalancer
</code></pre>

<p>According to <a href="https://github.com/helm/charts/tree/master/stable/postgresql" rel="noreferrer">stable/postgresql</a> helm chart, <code>initdbScripts</code> is a dictionary of init script names which are multi-line variables:</p>
<blockquote>
<pre><code>## initdb scripts
## Specify dictionary of scripts to be run at first boot
## Alternatively, you can put your scripts under the files/docker-entrypoint-initdb.d directory
##
# initdbScripts:
#   my_init_script.sh:|
#      #!/bin/sh
#      echo &quot;Do something.&quot;
</code></pre>
</blockquote>
<p>Let's assume that we have the following <code>init.sql</code> script:</p>
<pre><code>CREATE USER helm;
CREATE DATABASE helm;
GRANT ALL PRIVILEGES ON DATABASE helm TO helm;
</code></pre>
<p>When we are going to inject a multi-line text into values we need to deal with indentation in YAML.</p>
<p>For above particular case it is:</p>
<pre><code>helm install stable/postgresql -n testpg \
--set global.postgresql.postgresqlDatabase=testpg \
--set global.postgresql.postgresqlUsername=testpg \
--set global.postgresql.postgresqlPassword=testpg \
--set global.postgresql.servicePort=5432 \
--set initdbScripts.&quot;init\.sql&quot;=&quot;CREATE USER helm;
CREATE DATABASE helm;
GRANT ALL PRIVILEGES ON DATABASE helm TO helm;&quot; \
--set service.type=LoadBalancer
</code></pre>
<p>There is some explanation to above example:</p>
<ol>
<li>If script's name has <code>.</code> it should be escaped, like <code>&quot;init\.sql&quot;</code>.</li>
<li>Script's content is in double quotes, because it's multi-line string variable.</li>
</ol>
