<p>I am using helm version 2.14.1. I have created helm charts for an application that will be deployed by users to test their code on kubernetes cluster. I want to add labels for username values, so I can retrieve deployments by users (deployments by user labels). Is there a way to include system username in helm charts just like we do in Java with <code>System.getProperty(&quot;user.name&quot;)</code>. My helm template is like this:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include &quot;common.fullname&quot; . }}--{{ Release.name }}
  labels:
    application: {{ include &quot;common.name&quot; . }}
    branch: &quot;{{ Release.name }}&quot;
    username: &quot;{{ System.user.name }}&quot;   # need to fetch the logged in user from system here
spec:
...
</code></pre>
<p>Is there a standard way to achieve this or is there anyway I can allow users to input there usernames from command line while using <code>helm install</code> or <code>helm template</code> commands?</p>
<p>EDIT:
Although, the <code>--set</code> works for me in setting the values for my chart, I also need to set the same value in the dependencies. Something like this:</p>
<p>values.yaml</p>
<pre><code>username: &quot;&quot; 

dependency1:
 username: {{ .Values.username }} 

dependency2:
 username: {{ .Values.username }}

...

</code></pre>
<p>Of course the above implementation doesn't work. I need to reference the set value in the dependencies as well</p>

Avdhut Mankavale
<p>This is a community wiki answer based on the comments and posted for better visibility. Feel free to expand it.</p>
<p>You can use the <code>helm template</code> command with a <code>--set</code> option:</p>
<pre><code>--set stringArray              set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
--set-file stringArray         set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
--set-string stringArray       set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
</code></pre>
<p>The <code>--set</code> parameters have the highest precedence among other methods of passing values into the charts. It means that by default values come from the <code>values.yaml</code> which can be overridden by a parent chart's <code>values.yaml</code>, which can in turn be overridden by a user-supplied values file, which can in turn be overridden by <code>--set</code> parameters.</p>
<p>You can check more details and examples in the <a href="https://helm.sh/docs/chart_template_guide/values_files/" rel="nofollow noreferrer">official docs</a>.</p>
