<p>How can I get <code>.Values.someVal</code> from <code>values.yaml</code> file or passed through cli inside a <code>{{ range .Values.smtg }}</code> loop?</p>
<p>for eg.</p>
<pre><code>spec:
      containers:
      {{ range $k, $v := .Values.smtg }}
      - name: {{ $k }}
        image: {{ printf &quot;%s:%s&quot; (required &quot;no img&quot; $v) (required &quot;no tag&quot; .Values.someVal) | quote }}   &lt;&lt;&lt;--- how can I get .Values.someVal from values.yaml or cli? 
      {{- end }}
</code></pre>
<p>If I try to get them with <code>.Values.smtg</code> I will got : <code>... at &lt;.Values.someVal&gt;: nil pointer evaluating interface {}</code></p>

Padi
<p>Use <code>$.Values.someVal</code>. The <code>$</code> will always point to the root context:</p>
<pre><code>spec:
  containers:
  {{ range $k, $v := $.Values.smtg }}
  - name: {{ $k }}
    image: {{ printf &quot;%s:%s&quot; (required &quot;no img&quot; $v) (required &quot;no tag&quot; $.Values.someVal) | quote }} 
  {{- end }}
</code></pre>
