Skip to content

Commit

Permalink
fix merging bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn committed Sep 19, 2024
1 parent fd02b8b commit 5593c62
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
configMapKeyRef:
name: {{ $ats_cm }}
key: {{ $.Values.ats.existingConfigMap.keys.sfs_url }}
{{- range $key, $val := merge $.Values.liveIndexing.environment (index $.Values "liveIndexing" $serviceName "environment") }}
{{- range $key, $val := deepCopy $.Values.liveIndexing.environment | mustMerge (index $.Values "liveIndexing" $serviceName "environment") }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
configMapKeyRef:
name: {{ $ats_cm }}
key: {{ .Values.ats.existingConfigMap.keys.transform_url }}
{{- range $key, $val := (merge .Values.liveIndexing.environment .Values.liveIndexing.mediation.environment) }}
{{- range $key, $val := deepCopy .Values.liveIndexing.environment | mustMerge .Values.liveIndexing.mediation.environment }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,62 @@ tests:
content:
name: CUSTOM_ENV
value: custom_value
# documentIndex: content (0)
- contains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_CONTENT_ENV
value: custom_value
documentIndex: 0
- notContains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_METADATA_ENV
value: custom_value
documentIndex: 0
- notContains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_PATH_ENV
value: custom_value
documentIndex: 0

# documentIndex: metadata (1)
- contains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_METADATA_ENV
value: custom_value
documentIndex: 1
- notContains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_CONTENT_ENV
value: custom_value
documentIndex: 1
- notContains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_PATH_ENV
value: custom_value
documentIndex: 1

# documentIndex: path (2)
- contains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_PATH_ENV
value: custom_value
documentIndex: 2
- notContains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_CONTENT_ENV
value: custom_value
documentIndex: 2
- notContains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_METADATA_ENV
value: custom_value
documentIndex: 2

0 comments on commit 5593c62

Please sign in to comment.