feat(common): Release v2.5.0 (#258)

Co-authored-by: Maurits <75321636+maurits-funda@users.noreply.github.com>
Co-authored-by: Noam Lerner <bugok@users.noreply.github.com>
This commit is contained in:
Bernd Schorgers 2024-01-16 21:28:41 +01:00 committed by GitHub
parent 1582fe27c4
commit a548690b00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 670 additions and 56 deletions

View file

@ -0,0 +1,58 @@
{{/*
Env field used by the container.
*/}}
{{- define "bjw-s.common.lib.container.field.envFrom" -}}
{{- $ctx := .ctx -}}
{{- $rootContext := $ctx.rootContext -}}
{{- $containerObject := $ctx.containerObject -}}
{{- if not (empty (get $containerObject "envFrom")) -}}
{{- $envFrom := list -}}
{{- range $containerObject.envFrom -}}
{{- $item := dict -}}
{{- if hasKey . "configMap" -}}
{{- $configMap := include "bjw-s.common.lib.configMap.getByIdentifier" (dict "rootContext" $rootContext "id" .configMap) | fromYaml -}}
{{- $configMapName := default (tpl .configMap $rootContext) $configMap.name -}}
{{- $_ := set $item "configMapRef" (dict "name" $configMapName) -}}
{{- else if hasKey . "configMapRef" -}}
{{- if not (empty (dig "identifier" nil .configMapRef)) -}}
{{- $configMap := include "bjw-s.common.lib.configMap.getByIdentifier" (dict "rootContext" $rootContext "id" .configMapRef.identifier) | fromYaml -}}
{{- if empty $configMap -}}
{{- fail (printf "No configMap configured with identifier '%s'" .configMapRef.identifier) -}}
{{- end -}}
{{- $_ := set $item "configMapRef" (dict "name" $configMap.name) -}}
{{- else -}}
{{- $_ := set $item "configMapRef" (dict "name" (tpl .configMapRef.name $rootContext)) -}}
{{- end -}}
{{- else if hasKey . "secret" -}}
{{- $secret := include "bjw-s.common.lib.secret.getByIdentifier" (dict "rootContext" $rootContext "id" .secret) | fromYaml -}}
{{- $secretName := default (tpl .secret $rootContext) $secret.name -}}
{{- $_ := set $item "secretRef" (dict "name" $secretName) -}}
{{- else if hasKey . "secretRef" -}}
{{- if not (empty (dig "identifier" nil .secretRef)) -}}
{{- $secret := include "bjw-s.common.lib.secret.getByIdentifier" (dict "rootContext" $rootContext "id" .secretRef.identifier) | fromYaml -}}
{{- if empty $secret -}}
{{- fail (printf "No secret configured with identifier '%s'" .secretRef.identifier) -}}
{{- end -}}
{{- $_ := set $item "secretRef" (dict "name" $secret.name) -}}
{{- else -}}
{{- $_ := set $item "secretRef" (dict "name" (tpl .secretRef.name $rootContext)) -}}
{{- end -}}
{{- end -}}
{{- if not (empty (dig "prefix" nil .)) -}}
{{- $_ := set $item "prefix" .prefix -}}
{{- end -}}
{{- if not (empty $item) -}}
{{- $envFrom = append $envFrom $item -}}
{{- end -}}
{{- end -}}
{{- $envFrom | toYaml -}}
{{- end -}}
{{- end -}}