Skip to content

Commit d221dd9

Browse files
Check presence of nested keys
1 parent c70def3 commit d221dd9

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

charts/hdx-oss-v2/templates/hyperdx-deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ spec:
5252
- name: wait-for-mongodb
5353
image: busybox
5454
command: ['sh', '-c', 'until nc -z {{ include "hdx-oss.fullname" . }}-mongodb {{ .Values.mongodb.port }}; do echo waiting for mongodb; sleep 2; done;']
55-
{{- if .Values.hyperdx.initContainers.resources }}
55+
{{- if and (hasKey .Values.hyperdx "initContainer") (hasKey .Values.hyperdx.initContainer "resources") }}
5656
resources:
57-
{{- toYaml .Values.hyperdx.initContainers.resources | nindent 12 }}
57+
{{- toYaml .Values.hyperdx.initContainer.resources | nindent 12}}
5858
{{- end }}
5959
{{- end }}
6060
containers:

charts/hdx-oss-v2/tests/hyperdx-deployment_test.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,18 @@ tests:
302302
content:
303303
cpu: 2
304304
memory: 2Gi
305+
306+
- it: should not include initContainers resources when not configured and mongodb is enabled
307+
set:
308+
mongodb:
309+
enabled: true
310+
hyperdx:
311+
initContainers:
312+
asserts:
313+
- isNotEmpty:
314+
path: spec.template.spec.initContainers
315+
- equal:
316+
path: spec.template.spec.initContainers[0].name
317+
value: wait-for-mongodb
318+
- isEmpty:
319+
path: spec.template.spec.initContainers[0].resources

0 commit comments

Comments
 (0)