{{- if or .Values.serviceAccount.enabled -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  {{- with .Values.serviceAccount.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  labels:
    app: {{ template "oauth2-proxy.name" . }}
    chart: {{ template "oauth2-proxy.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
  name: {{ template "oauth2-proxy.fullname" . }}
{{- end -}}
