{{- $containerMode := .Values.containerMode }}
{{- if and (eq $containerMode.type "kubernetes") (not .Values.template.spec.serviceAccountName) }}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ include "gha-runner-scale-set.kubeModeServiceAccountName" . }}
  namespace: {{ .Release.Namespace }}
  finalizers:
    - actions.github.com/cleanup-protection
  labels:
    {{- include "gha-runner-scale-set.labels" . | nindent 4 }}
{{- end }}
