mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-06 01:27:42 +02:00
feat(common): Release common v4.1.0 (#416)
This commit is contained in:
parent
f3660654f4
commit
db552e2dee
52 changed files with 705 additions and 129 deletions
|
@ -4,19 +4,25 @@ Returns the value for serviceAccountName
|
|||
{{- define "bjw-s.common.lib.pod.field.serviceAccountName" -}}
|
||||
{{- $rootContext := .ctx.rootContext -}}
|
||||
{{- $controllerObject := .ctx.controllerObject -}}
|
||||
|
||||
{{- $enabledServiceAccounts := (include "bjw-s.common.lib.serviceAccount.enabledServiceAccounts" (dict "rootContext" $rootContext) | fromYaml ) }}
|
||||
{{- $serviceAccountName := "default" -}}
|
||||
|
||||
{{- with $controllerObject.serviceAccount -}}
|
||||
{{- if hasKey . "identifier" -}}
|
||||
{{- $subject := (include "bjw-s.common.lib.serviceAccount.getByIdentifier" (dict "rootContext" $rootContext "id" .identifier) | fromYaml) -}}
|
||||
{{- if not (has "serviceAccount" (keys $controllerObject)) -}}
|
||||
{{- if (eq (len $enabledServiceAccounts) 1) -}}
|
||||
{{- $serviceAccountName = ($enabledServiceAccounts | keys | first) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if hasKey $controllerObject.serviceAccount "identifier" -}}
|
||||
{{- $subject := (include "bjw-s.common.lib.serviceAccount.getByIdentifier" (dict "rootContext" $rootContext "id" $controllerObject.serviceAccount.identifier) | fromYaml) -}}
|
||||
|
||||
{{- if not $subject }}
|
||||
{{- fail (printf "No enabled ServiceAccount found with this identifier. (controller: '%s', identifier: '%s')" $controllerObject.identifier .identifier) -}}
|
||||
{{- fail (printf "No enabled ServiceAccount found with this identifier. (controller: '%s', identifier: '%s')" $controllerObject.identifier $controllerObject.serviceAccount.identifier) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $serviceAccountName = get $subject "name" -}}
|
||||
{{- else if hasKey . "name" -}}
|
||||
{{- $serviceAccountName = .name -}}
|
||||
{{- else if hasKey $controllerObject.serviceAccount "name" -}}
|
||||
{{- $serviceAccountName = $controllerObject.serviceAccount.name -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $serviceAccountName -}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue