Skip to content

Commit 2fea666

Browse files
committed
feature to prevent updating existing configmap
1 parent cd5a6a0 commit 2fea666

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

chart/templates/configmap.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
{{- $configMapName := printf "%s-config" (include "PolyNSI.fullname" .) }}
2+
3+
{{- $shouldCreate := true }}
4+
{{- if .Values.config.checkExistence }}
5+
{{- $shouldCreate = not (lookup "v1" "ConfigMap" .Release.Namespace $configMapName) }}
6+
{{- end }}
7+
8+
{{- if $shouldCreate }}
19
apiVersion: v1
210
kind: ConfigMap
311
metadata:
4-
name: {{ printf "%s-config" (include "PolyNSI.fullname" .) }}
12+
name: {{ $configMapName }}
513
# namespace: {{ .Release.Namespace }}
614
{{- if .Values.config.filesGlob }}
715
binaryData:
@@ -12,4 +20,5 @@ binaryData:
1220
{{ else if .Values.config.inline }}
1321
data:
1422
{{.Values.config.inline | indent 2}}
15-
{{ end }}
23+
{{ end }}
24+
{{- end }}

chart/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ truststore:
9898
key: truststore.jks
9999

100100
config:
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: |-

0 commit comments

Comments
 (0)