<p>I am using this chart : <a href="https://github.com/helm/charts/tree/master/stable/prometheus-mongodb-exporter" rel="noreferrer">https://github.com/helm/charts/tree/master/stable/prometheus-mongodb-exporter</a></p>

<p>This chart requires <code>MONGODB_URI</code> environment variable or <code>mongodb.uri</code> populated in <code>values.yaml</code> file,
Since this is a connection string I don't want to check-in that into git.
I was thinking of kubernetes secrets and provide the connection string from kubernetes secrets. I have not been able to successfully find a solution for this one.</p>

<p>I also tried creating another helm chart and using this one as a dependency for that chart and provide value for <code>MONGODB_URI</code> from <code>secrets.yaml</code> but that also didn't work because in <code>prometheus-mongodb-exporter</code> chart <code>MONGODB_URI</code> is defined as a required value which is then passed into <code>secrets.yaml</code> file within that chart, so dependency chart never gets installed because of that.</p>

<p>What would be the best way of achieving this?</p>

<h3>Solution 1: Create custom chart</h3>

<hr>

<ol>
<li>Delete the <code>secret.yaml</code> from chart's template directory.</li>
<li>Create the k8s <code>secret</code> on your own, maybe named <code>cumstom-secret</code></li>
<li>Edit the <code>deployment.yaml</code>: <a href="https://github.com/helm/charts/blob/master/stable/prometheus-mongodb-exporter/templates/deployment.yaml#L36" rel="nofollow noreferrer">here</a></li>
</ol>

<pre><code>       - name: MONGODB_URI
         valueFrom:
           secretKeyRef:
             name: custom-secret ## {{ include "prometheus-mongodb-exporter.fullname" . }}##
             key: mongodb-uri
</code></pre>

<hr>

<h3>Solution 2: Use original chart</h3>

<hr>

<ol>
<li>Set a dummy value for <code>mongodb.uri</code> in <code>value.yaml</code>.</li>
<li>Use <code>--set</code> flag to overwrite the dummy value with original while installing the chart. So, your <code>git</code> won't have the history.</li>
</ol>

<pre><code>$ helm install prometheus-mongodb-exporter stable/prometheus-mongodb-exporter --set mongodb.uri=******
</code></pre>
