如何访问模板中的数组项(例如[2]) ?
每当我这样做,我得到“坏字符 U + 005B’[’”
{{ .a[2] }}
You need to use the index template function.
index
\{\{index .a 2}}
to access a field on an array item as go templating in *.yaml format :
\{\{ (index .Values.fields 0).fieldItem }}
Index of zero(0) as in fields array of field as fieldItem .