{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ include "oncall.serviceAccountName" . }}
  labels:
    {{- include "oncall.labels" . | nindent 4 }}
  {{- if or (.Values.migrate.useHook) (.Values.serviceAccount.annotations) }}
  annotations:
    {{- if .Values.migrate.useHook }}
    "helm.sh/hook": pre-install,pre-upgrade
    "helm.sh/hook-weight": "-5"
    {{- end }}
    {{- with .Values.serviceAccount.annotations }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
  {{- end }}
{{- end }}
