{{- $sa := .Values.serviceAccount }} {{- if $sa.create }} {{- $ctx := dict "helm" . }} {{- $fullname := include "vm.plain.fullname" $ctx }} {{- $ns := include "vm.namespace" $ctx }} apiVersion: v1 kind: ServiceAccount metadata: {{- $_ := set $ctx "extraLabels" $sa.extraLabels }} labels: {{ include "vm.metaLabels" $ctx | nindent 4 }} {{- $_ := unset $ctx "extraLabels" }} {{- with $sa.annotations }} annotations: {{ toYaml . | nindent 4 }} {{- end }} name: {{ (.Values.serviceAccount).name | default $fullname }} namespace: {{ $ns }} {{- end }}