I am trying to access the individual value from an array available in values.yaml file from my helmchart. My values.yaml file content
peer_cidr:
- x
- y
- z
Accessing from helm chart :
{{- $dn_count := len .Values.no_of_peers }}
{{- $end := sub $dn_count 1 }}
"routes": [
{{- $root := . -}}
{{ range $i, $dn := until (atoi (printf "%d" (int64 .Values.no_of_peers))) }}
{ "dst": "{{ index $root "Values" "ipv4_routing" "peer_cidr_list" (printf "%d" ($i) ) }}", "gw": "{{ $root.Values.ipv4_routing.gateway}}"}
With index function iam providing the index but iam facing below error error calling index: cannot index slice/array with type string
Kindly help