【发布时间】:2021-10-04 18:12:50
【问题描述】:
我有以下 Helm 模板定义:
{{- define "api.test-drive" -}}
{{- if not .Values.global.testDrive }}
{{- printf "%s" .Values.default.TEST_DRIVE | quote -}}
{{- else -}}
{{- printf "%s" .Values.global.testDrive | title | quote -}}
{{- end -}}
{{- end -}}
在 configmap 模板中包含以下内容:
TEST_DRIVE: {{ include "api.test-drive" . }}
还有一个全局值global.testDrive: true。然而,当 Helm 执行这个插入到 configmap 中时,它会将其存储为:
TEST_DRIVE:
----
%!S(Bool=True)
不应该 printf 将 global.testDrive 从 bool true 转换为字符串,然后应用 title 和 quote 函数吗?目前尚不清楚这里发生了什么。
【问题讨论】:
标签: kubernetes-helm go-templates