mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-03 08:37:03 +02:00
17 lines
877 B
Smarty
17 lines
877 B
Smarty
{{/*
|
|
Return a ServiceAccount Object by its Identifier.
|
|
*/}}
|
|
{{- define "bjw-s.common.lib.serviceAccount.getByIdentifier" -}}
|
|
{{- $rootContext := .rootContext -}}
|
|
{{- $identifier := .id -}}
|
|
{{- if eq $identifier "default" -}}
|
|
{{- include "bjw-s.common.lib.serviceAccount.valuesToObject" (dict "rootContext" $rootContext "id" "default" "values" $rootContext.Values.serviceAccount) -}}
|
|
{{- else -}}
|
|
{{- $serviceAccountValues := dig "extraServiceAccounts" $identifier nil $rootContext.Values.serviceAccount -}}
|
|
{{- if not (empty $serviceAccountValues) -}}
|
|
{{- include "bjw-s.common.lib.serviceAccount.valuesToObject" (dict "rootContext" $rootContext "id" $identifier "values" $serviceAccountValues) -}}
|
|
{{- else -}}
|
|
{{- fail (printf "No ServiceAccount configured with identifier: %s" $identifier) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|