{{- if .Values.serviceAccount -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ .Values.serviceAccount }}
  namespace: {{ template "mongodb-replicaset.namespace" . }}
  labels:
    app: {{ template "mongodb-replicaset.name" . }}
    chart: {{ template "mongodb-replicaset.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  {{- if .Values.extraLabels }}
  {{ toYaml .Values.extraLabels | indent 4 }}
  {{- end }}
{{- end -}}
