0

I couldn't find any documentation, but I keep seeing examples.

Like:

{{- 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 }}
Numichi
  • 926
  • 6
  • 14

1 Answers1

2

Helm uses standard Go templating. Have a look at https://pkg.go.dev/text/template#hdr-Text_and_spaces In short {{- something }} means "trim left whitespace" and {{ something -}} means "trim right whitespace". | nindent 4 means "add 4 spaces before". You need this operators for correct indenting your yaml.

JGK
  • 3,710
  • 1
  • 21
  • 26