我正在创建一个舵图,我想在其中使用模板函数指定一个默认值。具体地说,我希望使用重写值image.name,或者默认使用模板函数chart.name:
{{ .Values.image.name | default include chart.name . }}
但是在绘制图表时,我遇到了以下错误:
[ERROR] templates/: render error in "chart/templates/deployment.yaml": template: chart/templates/deployment.yaml:22:81: executing "chart/templates/deployment.yaml" at <include>: wrong number of args for include: want 2 got 0
是否可以使用包含的模板函数作为默认值?或者我只能使用字面量?
发布于 2019-03-22 14:21:57
你可以的。只需将您的include语句括在括号中:
{{ .Values.image.name | default (include "chart.name" .)}}
https://stackoverflow.com/questions/55280987
复制相似问题