我找不到任何文档,但我不断看到示例。
例如:
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{- include "example.serviceAccountName" . -}} ##<=== {{- -}}
example: {{ .Values.example.example }} ##<=== {{ }}
labels:
{{- include "alma.labels" . | nindent 4 }} ##<=== {{- }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}发布于 2021-11-18 07:34:51
Helm使用标准的Go模板。简单地看一下https://pkg.go.dev/text/template#hdr-Text,{{- something }}的意思是“修剪左边的空格”,{{ something -}}的意思是“修剪右边的空格”。| nindent 4的意思是“在前添加4个空格”。你需要这个操作符来正确地缩进你的yaml。
https://stackoverflow.com/questions/69992198
复制相似问题