{{- if .Values.serviceAccount.server.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ include "velero.serverServiceAccount" . }}
  namespace: {{ .Release.Namespace }}
{{- if .Values.serviceAccount.server.annotations }}
  annotations:
{{ toYaml .Values.serviceAccount.server.annotations | nindent 4 }}
{{- end }}
  labels:
    app.kubernetes.io/name: {{ include "velero.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    helm.sh/chart: {{ include "velero.chart" . }}
{{- with .Values.serviceAccount.server.labels }}
  {{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
