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