{{- if .Values.startupapicheck.enabled -}}
{{- if .Values.startupapicheck.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
automountServiceAccountToken: {{ .Values.startupapicheck.serviceAccount.automountServiceAccountToken }}
metadata:
  name: {{ template "startupapicheck.serviceAccountName" . }}
  namespace: {{ .Release.Namespace | quote }}
  {{- if .Values.startupapicheck.serviceAccount.annotations }}
  annotations:
{{ toYaml .Values.startupapicheck.serviceAccount.annotations | indent 4 }}
  {{- end }}
  labels:
    app: {{ include "startupapicheck.name" . }}
    app.kubernetes.io/name: {{ include "startupapicheck.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/component: "startupapicheck"
    {{- include "labels" . | nindent 4 }}
{{- if .Values.global.imagePullSecrets }}
imagePullSecrets: {{ toYaml .Values.global.imagePullSecrets | nindent 2 }}
{{- end }}
{{- end -}}
{{- end -}}
