{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ template "prometheus-postgres-exporter.serviceAccountName" . }}
  labels:
    app: {{ template "prometheus-postgres-exporter.name" . }}
    chart: {{ template "prometheus-postgres-exporter.chart" . }}
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
  {{- if .Values.serviceAccount.annotations }}
  annotations:
    {{ toYaml .Values.serviceAccount.annotations }}
  {{- end }}
{{- end -}}
