use*_*963 2 go-templates kubernetes kubernetes-helm
我无法为 Helm Chart 渲染模板,该模板需要具有可轻松扩展的节点和副本数量。我收到以下错误消息。奇怪的是,如果我删除了内部循环而不是嵌套循环,我不会收到以下错误消息。我是全新的,但这似乎有效。我不知所措。
错误:
$ helm install . --dry-run --debug
Error: render error in "app-on-k8s/templates/configmap_configd.yaml": template: app-on-k8s/templates/configmap_configd.yaml:18:77: executing "app-on-k8s/templates/configmap_configd.yaml" at <.Values.nodeCount>: can't evaluate field Values in type int
Run Code Online (Sandbox Code Playgroud)
这是我的 values.yaml 文件中的相关部分:
# number of nodes / shards
nodeCount: 5
replicaCount: 3
Run Code Online (Sandbox Code Playgroud)
我的模板文件中的相关部分:
<default>
{{range $i, $e := until (atoi (printf "%d" (int64 .Values.nodeCount))) }}
<node>
{{range $j, $k := until (atoi (printf "%d" (int64 .Values.replicaCount))) }} #line 18
<replica>
<host>{{ $.Release.Name }}-{{$j}}</host>
<port>{{ $.Values.service.rpc_port }}</port>
</replica>
{{end}}
</node>
{{end}}
</default>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2262 次 |
| 最近记录: |