我正在尝试从我的 helmchart 的 values.yaml 文件中可用的数组访问单个值。我的 values.yaml 文件内容
peer_cidr:
- x
- y
- z
从掌舵图访问:
{{- $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}}"}
使用索引函数 iam 提供索引,但 iam 面临以下错误错误调用索引:无法使用字符串类型索引切片/数组
请帮助