File tree Expand file tree Collapse file tree 2 files changed +30
-6
lines changed Expand file tree Collapse file tree 2 files changed +30
-6
lines changed Original file line number Diff line number Diff line change 1+ {{- $configMapName := printf "%s-config" (include "PolyNSI.fullname" .) }}
2+ {{- $existingConfigMap := "" }}
3+ {{- if .Values.config.checkExistence }}
4+ {{- $existingConfigMap = lookup "v1" "ConfigMap" .Release.Namespace $configMapName }}
5+ {{- end }}
6+
17apiVersion : v1
28kind : ConfigMap
39metadata :
4- name : {{ printf "%s-config" (include "PolyNSI.fullname" .) }}
10+ name : {{ $configMapName }}
511# namespace: {{ .Release.Namespace }}
12+ {{- if and .Values.config.checkExistence $existingConfigMap }}
13+ # Preserve existing ConfigMap data
14+ {{- if $existingConfigMap.data }}
15+ data :
16+ {{- range $key, $value := $existingConfigMap.data }}
17+ {{ $key }}: {{ $value | quote }}
18+ {{- end }}
19+ {{- end }}
20+ {{- if $existingConfigMap.binaryData }}
21+ binaryData :
22+ {{- range $key, $value := $existingConfigMap.binaryData }}
23+ {{ $key }}: {{ $value }}
24+ {{- end }}
25+ {{- end }}
26+ {{- else }}
27+ # Create new ConfigMap data from values
628{{- if .Values.config.filesGlob }}
729binaryData :
830{{- range $path, $_ := .Files.Glob .Values.config.filesGlob }}
9- {{ $path | base | indent 2 }} : |-
31+ {{ $path | base }} : |-
1032{{ $.Files.Get $path | b64enc | indent 4 }}
11- {{ end }}
12- {{ else if .Values.config.inline }}
33+ {{- end }}
34+ {{- else if .Values.config.inline }}
1335data :
14- {{.Values.config.inline | indent 2}}
15- {{ end }}
36+ {{ .Values.config.inline | indent 2 }}
37+ {{- end }}
38+ {{- end }}
Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ truststore:
9898 key : truststore.jks
9999
100100config :
101+ checkExistence : false # Set to true to not overwrite existing configmap.
101102 # either read config files from folder or use inline data, filesGlob takes precedence over inline.
102103 # filesGlob: "config/*"
103104 inline : |-
You can’t perform that action at this time.
0 commit comments