{{- if .Values.serviceAccount.controller.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ .Values.serviceAccount.controller.name }}
  labels:
    {{- include "aws-ebs-csi-driver.labels" . | nindent 4 }}
  {{- with .Values.serviceAccount.controller.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  {{- if eq .Release.Name "kustomize" }}
  #Enable if EKS IAM for SA is used
  #annotations:
  #  eks.amazonaws.com/role-arn: arn:aws:iam::586565787010:role/ebs-csi-role
  {{- end }}
{{- end -}}
