{{- if and .Values.haproxy.enabled .Values.haproxy.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ include "haproxy.serviceAccountName" . }}
  labels:
    {{- include "haproxy.labels" . | nindent 4 }}
  {{- with .Values.haproxy.serviceAccount.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
automountServiceAccountToken: {{ .Values.haproxy.serviceAccount.automountToken }}
{{- end }}
