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

@ -4,25 +4,18 @@ Renders the configMap objects required by the chart.
{{- define "bjw-s.common.render.configMaps" -}}
{{- $rootContext := $ -}}
{{- /* Generate named configMaps as required */ -}}
{{- range $key, $configMap := .Values.configMaps }}
{{- /* Enable configMap by default, but allow override */ -}}
{{- $configMapEnabled := true -}}
{{- if hasKey $configMap "enabled" -}}
{{- $configMapEnabled = $configMap.enabled -}}
{{- end -}}
{{- /* Generate configMaps as required */ -}}
{{- $enabledConfigMaps := (include "bjw-s.common.lib.configMap.enabledConfigmaps" (dict "rootContext" $rootContext) | fromYaml ) -}}
{{- if $configMapEnabled -}}
{{- $configMapValues := (mustDeepCopy $configMap) -}}
{{- range $identifier := keys $enabledConfigMaps -}}
{{- /* Generate object from the raw configMap values */ -}}
{{- $configMapObject := (include "bjw-s.common.lib.configMap.getByIdentifier" (dict "rootContext" $rootContext "id" $identifier) | fromYaml) -}}
{{- /* Create object from the raw configMap values */ -}}
{{- $configMapObject := (include "bjw-s.common.lib.valuesToObject" (dict "rootContext" $rootContext "id" $key "values" $configMapValues)) | fromYaml -}}
{{- /* Perform validations on the configMap before rendering */ -}}
{{- include "bjw-s.common.lib.configMap.validate" (dict "rootContext" $ "object" $configMapObject "id" $key) -}}
{{- /* Perform validations on the configMap before rendering */ -}}
{{- include "bjw-s.common.lib.configMap.validate" (dict "rootContext" $rootContext "object" $configMapObject "id" $identifier) -}}
{{/* Include the configMap class */}}
{{- include "bjw-s.common.class.configMap" (dict "rootContext" $ "object" $configMapObject) | nindent 0 -}}
{{- end -}}
{{- include "bjw-s.common.class.configMap" (dict "rootContext" $rootContext "object" $configMapObject) | nindent 0 -}}
{{- end -}}
{{- end -}}
@ -30,23 +23,26 @@ Renders the configMap objects required by the chart.
Renders configMap objects required by the chart from a folder in the repo's path.
*/}}
{{- define "bjw-s.common.render.configMaps.fromFolder" -}}
{{- $rootContext := $ -}}
{{- $valuesCopy := .Values -}}
{{- $configMapsFromFolder := .Values.configMapsFromFolder | default dict -}}
{{- $valuesCopy := $rootContext.Values -}}
{{- $configMapsFromFolder := $rootContext.Values.configMapsFromFolder | default dict -}}
{{- $configMapsFromFolderEnabled := dig "enabled" false $configMapsFromFolder -}}
{{- if $configMapsFromFolderEnabled -}}
{{- /* Perform validations before rendering */ -}}
{{- include "bjw-s.common.lib.configMap.fromFolder.validate" (dict "rootContext" $ "basePath" $configMapsFromFolder.basePath) -}}
{{- $basePath := $configMapsFromFolder.basePath -}}
{{/* Generate a list of unique top level folders */}}
{{ $topLevelFolders := dict}}
{{- $basePath := $configMapsFromFolder.basePath -}}
{{- $topLevelFolders := dict -}}
{{- range $path, $_ := .Files.Glob (printf "%s/*/*" $basePath) -}}
{{- $_ := set $topLevelFolders (dir $path) "" -}}
{{- end -}}
{{- $top_level_folder_list := keys $topLevelFolders | sortAlpha -}}
{{/* Iterate over the top level folders */}}
{{ range $path := $top_level_folder_list }}
{{- /* Iterate over the top level folders */ -}}
{{- range $path := $top_level_folder_list -}}
{{- $folder := base $path -}}
{{- $configMapData := dict -}}
{{- $configMapBinaryData := dict -}}
@ -70,16 +66,16 @@ Renders configMap objects required by the chart from a folder in the repo's path
{{- $configMapData = merge $configMapData (dict $file $fileContent) -}}
{{- end -}}
{{- end -}}
{{ end }}
{{- end -}}
{{- $configMapValues := dict "enabled" true "forceRename" $configMapForceRename "labels" $configMapLabels "annotations" $configMapAnnotations "data" $configMapData "binaryData" $configMapBinaryData -}}
{{- $configMapObject := (include "bjw-s.common.lib.valuesToObject" (dict "rootContext" $ "id" $folder "values" $configMapValues)) | fromYaml -}}
{{/* Append it to .Values.configMaps so it can be created by "bjw-s.common.render.configMaps" and fetched by identifier */}}
{{- $existingConfigMaps := (get $valuesCopy "configMaps"| default dict) -}}
{{- $mergedConfigMaps := deepCopy $existingConfigMaps | merge (dict (base $path) $configMapValues) -}}
{{- $valuesCopy := merge $valuesCopy (dict "configMaps" $mergedConfigMaps) -}}
{{ end }}
{{ end }}
{{- $configMapObject := (include "bjw-s.common.lib.valuesToObject" (dict "rootContext" $rootContext "id" $folder "values" $configMapValues) | fromYaml) -}}
{{ end }}
{{- /* Append it to .Values.configMaps so it can be created by "bjw-s.common.render.configMaps" and fetched by identifier */ -}}
{{- $existingConfigMaps := (get $valuesCopy "configMaps" | default dict) -}}
{{- $mergedConfigMaps := deepCopy $existingConfigMaps | merge (dict $folder $configMapObject) -}}
{{- $valuesCopy := merge $valuesCopy (dict "configMaps" $mergedConfigMaps) -}}
{{- end -}}
{{- end -}}
{{- end -}}