{{- if and .Values.rbac.create .Values.rbac.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ template "serviceaccount.name" . }}
  labels:
    app.kubernetes.io/name: {{ include "aws-alb-ingress-controller.name" . }}
    helm.sh/chart: {{ include "aws-alb-ingress-controller.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.rbac.serviceAccount.annotations }}
  annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- end }}
