feat: Bump common library to v3.4.0 (#349)

This commit is contained in:
Bernd Schorgers 2024-08-27 14:16:37 +02:00
parent a78c21ab00
commit 86062681a9
No known key found for this signature in database
GPG key ID: BC5E2BD907F9A8EC
45 changed files with 1023 additions and 149 deletions

View file

@ -24,3 +24,36 @@ Renders the configMap objects required by the chart.
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Renders configMap objects required by the chart from a folder in the repo's path.
*/}}
{{- define "bjw-s.common.render.configMaps.fromFiles" -}}
{{- $rootValues := .Values -}}
{{/* Generate a list of unique top level folders */}}
{{ $topLevelFolders := dict}}
{{- range $path, $_ := .Files.Glob (printf "%s/*/*" .Values.configMapsFromFolderBasePath) -}}
{{- $_ := set $topLevelFolders (dir $path) "" -}}
{{- end -}}
{{- $top_level_folder_list := keys $topLevelFolders | sortAlpha -}}
{{/* Iterate over the top level folders */}}
{{ range $path := $top_level_folder_list }}
{{- $filesContentNoFormat := ($.Files.Glob (printf "%s/*" $path)) -}}
{{- $filesContent := dict -}}
{{- range $file_name, $content := $filesContentNoFormat -}}
{{- $key := base $file_name -}}
{{- if contains ".escape" $key -}}
{{- $key := $key | replace ".escape" "" -}}
{{- $filesContent = merge $filesContent (dict $key (($.Files.Get $file_name) | replace "{{" "{{ `{{` }}")) -}}
{{- else -}}
{{- $filesContent = merge $filesContent (dict $key ($.Files.Get $file_name)) -}}
{{- end -}}
{{- end -}}
{{- $configMapValues := dict "enabled" true "labels" dict "annotations" dict "data" $filesContent -}}
{{- $existingConfigMaps := (get $rootValues "configMaps"| default dict) -}}
{{- $mergedConfigMaps := deepCopy $existingConfigMaps | merge (dict (base $path) $configMapValues) -}}
{{- $rootValues := merge $rootValues (dict "configMaps" $mergedConfigMaps) -}}
{{ end }}
{{ end }}