<p>I'm using the <code>mongodb</code> helm chart and the <code>mongo-express</code> one. <code>mongodb</code> generates the name depending on my release name, so it is dynamic. The <code>mongodb</code> service name will be something like <code>my-release-mongodb</code>.</p>
<p><code>mongo-express</code> requires to pass <code>mongodbServer</code> - the location at which the <code>mongodb</code> can be reached. How can I provide this value to <code>mongo-express</code> if it is generated and can change depending on the release name?</p>

enyo
<p>Helm doesn't directly have this ability.  (See also <a href="https://stackoverflow.com/questions/55425688/helm-programmatically-override-subchart-values-yaml">helm - programmatically override subchart values.yaml</a>.)  It has a couple of ways to <a href="https://docs.helm.sh/docs/topics/charts/#importing-child-values-via-dependencies" rel="nofollow noreferrer">propagate configured values from a subchart to a parent</a> but not to use computed values, or to send these values to a sibling chart.</p>
<p>In the particular case of Services created by a subchart, I've generally considered the Service name as part of the chart's &quot;API&quot;: you know the Service will be named <code>{{ .Release.Name }}-mongodb</code> and you just have to hard-code that in the consuming chart.</p>
<p>If you're launching this under a single &quot;umbrella&quot; chart, this is a little more straightforward.  Both parts have the same release name, so you can construct the service name the same way.  (Umbrella charts have other limitations – if you have multiple services that each should have an independent MongoDB installation, Helm will only deploy the database once for the whole umbrella chart – but you can still hit this same problem making HTTP calls between microservices.)</p>
<p>If they're totally separate installations, you may need to pick the release name yourself and pass it in as a value.</p>
<pre class="lang-sh prettyprint-override"><code>helm install thedb ./mongodb
helm install theapp ./mongo-express --set serviceName=thedb-mongodb
</code></pre>
<p>This also a place where a still higher-level tool like <a href="https://github.com/roboll/helmfile" rel="nofollow noreferrer">Helmfile</a> or <a href="https://github.com/Praqma/helmsman" rel="nofollow noreferrer">Helmsman</a> can come in handy, since that would let you specify these parameters in a fixed file.</p>
