<p>I work with four teams that are using exactly the same environments that are set up in kubernetes namespaces.
I have created helm charts to install those environments. Everything works fine but I have to create ingresses by hand because of the following format in hostname:</p>

<pre><code>&lt;namespace&gt;.&lt;app&gt;.&lt;k8sdomain&gt;
</code></pre>

<p>The thing is I would like to just change context with kubectl and then run those charts instead of editing every single values.yaml to change namespace variable.</p>

<p>Is it possible to use some predefined or dynamic variable that would add the correct namespace to the host in ingress?</p>

<p>Or is there any other solution that would help me to solve this problem?</p>

<p>Thanks.</p>

<p>The namespace value can be derived either from <code>--namespace</code> parameter which is the same namespace where helm chart is deployed to. In the charts it should be accessed with <code>{{.Release.Namespace}}</code> then.
Or you can set these namespaces using <code>--set</code> when deploying helm chart with <code>helm upgrade</code>. If there are few environments you can access them as aliases in <code>values.yaml</code> and then set namespaces values for them like this:</p>

<pre><code>helm upgrade \
   &lt;chart_name&gt; \
      &lt;path_to_the_chart&gt; \
        --set &lt;environment_one&gt;.namespace=namespace1 \
        --set &lt;environment_two&gt;.namespace=namespace2 \
...
</code></pre>
