feat(common): Release common 4.0.0 (#398)

Co-authored-by: lab-assistant[bot] <180935599+lab-assistant[bot]@users.noreply.github.com>
This commit is contained in:
Bernd Schorgers 2025-05-16 08:40:39 +02:00
parent 1e210f43e3
commit a01a89cb13
No known key found for this signature in database
327 changed files with 11181 additions and 7330 deletions

View file

@ -0,0 +1,23 @@
{{/*
Return the enabled configMaps.
*/}}
{{- define "bjw-s.common.lib.configMap.enabledConfigmaps" -}}
{{- $rootContext := .rootContext -}}
{{- $enabledSecrets := dict -}}
{{- range $identifier, $secret := $rootContext.Values.configMaps -}}
{{- if kindIs "map" $secret -}}
{{- /* Enable Secret by default, but allow override */ -}}
{{- $secretEnabled := true -}}
{{- if hasKey $secret "enabled" -}}
{{- $secretEnabled = $secret.enabled -}}
{{- end -}}
{{- if $secretEnabled -}}
{{- $_ := set $enabledSecrets $identifier . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $enabledSecrets | toYaml -}}
{{- end -}}

View file

@ -4,9 +4,10 @@ Return a configMap Object by its Identifier.
{{- define "bjw-s.common.lib.configMap.getByIdentifier" -}}
{{- $rootContext := .rootContext -}}
{{- $identifier := .id -}}
{{- $enabledConfigMaps := (include "bjw-s.common.lib.configMap.enabledConfigmaps" (dict "rootContext" $rootContext) | fromYaml ) }}
{{- $configMapValues := dig $identifier nil $rootContext.Values.configMaps -}}
{{- if not (empty $configMapValues) -}}
{{- include "bjw-s.common.lib.valuesToObject" (dict "rootContext" $rootContext "id" $identifier "values" $configMapValues) -}}
{{- if (hasKey $enabledConfigMaps $identifier) -}}
{{- $objectValues := get $enabledConfigMaps $identifier -}}
{{- include "bjw-s.common.lib.valuesToObject" (dict "rootContext" $rootContext "id" $identifier "values" $objectValues "itemCount" (len $enabledConfigMaps)) -}}
{{- end -}}
{{- end -}}

View file

@ -6,9 +6,10 @@ Validate configMap values
{{- $configMapValues := .object -}}
{{- $identifier := .id -}}
{{- if empty $configMapValues -}}
{{- if eq (len (without (keys $configMapValues) "name" "identifier")) 0 -}}
{{- fail (printf "There was an error loading ConfigMap: %s. If it was automatically generated from a folder verify that files are properly flagged as `binary` or `escaped`" $identifier) -}}
{{- end -}}
{{- if and (empty (get $configMapValues "data")) (empty (get $configMapValues "binaryData")) -}}
{{- fail (printf "No data or binaryData specified for configMap. (configMap: %s)" $configMapValues.identifier) }}
{{- end -}}