{{- if .Values.rbac.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ .Values.controller.serviceAccount.name }}
  labels:
    app: {{ .Values.controller.name | trunc 63 }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
{{- if .Values.controller.serviceAccount.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.controller.serviceAccount.imagePullSecrets }}
{{- end }}
{{- end }}
