{{- if and .Values.kubeStateMetrics.enabled .Values.serviceAccounts.kubeStateMetrics.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    {{- include "prometheus.kubeStateMetrics.labels" . | nindent 4 }}
  name: {{ template "prometheus.serviceAccountName.kubeStateMetrics" . }}
{{ include "prometheus.namespace" . | indent 2 }}
  annotations:
{{ toYaml .Values.serviceAccounts.alertmanager.annotations | indent 4 }}
{{- end -}}
