{{- $hasCustomResourceMeta := (and .Values.resourceMeta .Values.resourceMeta.noPermissionServiceAccount) }} {{- $containerMode := .Values.containerMode }} {{- if and (ne $containerMode.type "kubernetes") (not .Values.template.spec.serviceAccountName) }} apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "gha-runner-scale-set.noPermissionServiceAccountName" . }} namespace: {{ include "gha-runner-scale-set.namespace" . }} labels: {{- $base := include "gha-runner-scale-set.labels" . | fromYaml }} {{- $extra := dict "app.kubernetes.io/component" "" }} {{- $reserved := merge $base $extra }} {{- with .Values.labels }} {{- range $k, $v := . }} {{- if not (or (hasKey $reserved $k) (hasPrefix "actions.github.com/" $k)) }} {{ $k }}: {{ $v | quote }} {{- end }} {{- end }} {{- end }} {{- if $hasCustomResourceMeta }} {{- with .Values.resourceMeta.noPermissionServiceAccount.labels }} {{- toYaml . | nindent 4 }} {{- end }} {{- end }} {{- include "gha-runner-scale-set.labels" . | nindent 4 }} annotations: {{- with .Values.annotations }} {{- toYaml . | nindent 4 }} {{- end }} {{- if $hasCustomResourceMeta }} {{- with .Values.resourceMeta.noPermissionServiceAccount.annotations }} {{- toYaml . | nindent 4 }} {{- end }} {{- end }} finalizers: - actions.github.com/cleanup-protection {{- end }}