将地图列表重写为 go-template 中的字符串列表
Rewrite list of maps to list of string in go-template
我有以下命令:
kubectl get deployment my_dep -o go-template --template "{{( index .spec.template.spec.containers 0).env}}"
它returns:
[map[name:B value:VB] map[name:A value:VA] map[name:C value:VC]...]
我们可以假设列表中的每张地图只有一个条目。
是否可以编写这样的模板,将其重写为以下形式:
[B=VB, A=VA, C=VC,...]
?
Is it possible to write such template that it rewrite it to following form: [B=VB, A=VA, C=VC,...] ?
没有
None 的内置函数允许这样做。
我有以下命令:
kubectl get deployment my_dep -o go-template --template "{{( index .spec.template.spec.containers 0).env}}"
它returns:
[map[name:B value:VB] map[name:A value:VA] map[name:C value:VC]...]
我们可以假设列表中的每张地图只有一个条目。
是否可以编写这样的模板,将其重写为以下形式:
[B=VB, A=VA, C=VC,...]
?
Is it possible to write such template that it rewrite it to following form: [B=VB, A=VA, C=VC,...] ?
没有
None 的内置函数允许这样做。