{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    {{- include "k8s-prometheus-adapter.labels" . | indent 4 }}
  name: {{ template "k8s-prometheus-adapter.serviceAccountName" . }}
  namespace: {{ include "k8s-prometheus-adapter.namespace" . }}
{{- if or .Values.serviceAccount.annotations .Values.customAnnotations }}
  annotations:
  {{- if .Values.serviceAccount.annotations }}
  {{- toYaml .Values.serviceAccount.annotations | nindent 4 }}
  {{- end }}
  {{- if .Values.customAnnotations }}
  {{- toYaml .Values.customAnnotations | nindent 4 }}
  {{- end }}
{{- end }}
{{- end -}}
