<p>As a followup question to my post <a href="https://stackoverflow.com/questions/66191604/helm-function-to-set-value-based-on-a-variable">Helm function to set value based on a variable?</a>, and modifying the answer given in <a href="https://stackoverflow.com/questions/52742241/dynamically-accessing-values-depending-on-variable-values-in-a-helm-chart">Dynamically accessing values depending on variable values in a Helm chart</a>, I'm trying this</p>
<pre><code>$ helm version --short
v3.5.2+g167aac7

values.yaml
-----------
env: sandbox
environments:
  sandbox: 0
  staging: 1
  production: 2
replicaCount:
  - 1
  - 2
  - 4

templates/deployments.yaml
--------------------------
apiVersion: apps/v1
kind: Deployment
metadata:
...
spec:
  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ index .Values.replicaCount (pluck .Values.env .Values.environments | first | default .Values.environments.sandbox) }}
</code></pre>
<p>But I get</p>
<pre><code>$ helm template . --dry-run
Error: template: guestbook/templates/deployment.yaml:10:15: executing &quot;guestbook/templates/deployment.yaml&quot; at &lt;index .Values.replicaCount (pluck .Values.env .Values.environments | first | default .Values.environments.sandbox)&gt;: error calling index: cannot index slice/array with type float64
</code></pre>
<p>Why is <code>pluck</code> returning a <code>float64</code> instead of an integer, which I expect since my <code>environments</code> dictionary values are integers?</p>

Chris F
<p>If I do this, that is, pipe <code>pluck</code> with the <code>int</code> converter, it works, but it doesn't explain why <code>pluck</code> returns a <code>float64</code> value.</p>
<pre><code>templates/deployments.yaml
--------------------------
apiVersion: apps/v1
kind: Deployment
metadata:
...
spec:
  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ index .Values.replicaCount ((pluck .Values.env .Values.environments | first | default .Values.environments.sandbox) | int) }}
</code></pre>
<p><strong>UPDATE:</strong> It turns out to be a known bug. See <a href="https://github.com/kubernetes-sigs/yaml/issues/45" rel="nofollow noreferrer">https://github.com/kubernetes-sigs/yaml/issues/45</a></p>
