diff --git a/charts/hdx-oss-v2/templates/hyperdx-deployment.yaml b/charts/hdx-oss-v2/templates/hyperdx-deployment.yaml index 7d58e0a..c90d0a9 100644 --- a/charts/hdx-oss-v2/templates/hyperdx-deployment.yaml +++ b/charts/hdx-oss-v2/templates/hyperdx-deployment.yaml @@ -52,6 +52,10 @@ spec: - name: wait-for-mongodb image: busybox command: ['sh', '-c', 'until nc -z {{ include "hdx-oss.fullname" . }}-mongodb {{ .Values.mongodb.port }}; do echo waiting for mongodb; sleep 2; done;'] + {{- if and (hasKey .Values.hyperdx "initContainer") (hasKey .Values.hyperdx.initContainer "resources") }} + resources: + {{- toYaml .Values.hyperdx.initContainer.resources | nindent 12}} + {{- end }} {{- end }} containers: - name: app diff --git a/charts/hdx-oss-v2/tests/hyperdx-deployment_test.yaml b/charts/hdx-oss-v2/tests/hyperdx-deployment_test.yaml index 10e3cf0..dfea09c 100644 --- a/charts/hdx-oss-v2/tests/hyperdx-deployment_test.yaml +++ b/charts/hdx-oss-v2/tests/hyperdx-deployment_test.yaml @@ -269,4 +269,51 @@ tests: value: private-registry-secret - lengthEqual: path: spec.template.spec.imagePullSecrets - count: 3 \ No newline at end of file + count: 3 + + - it: should include initContainers resources when configured and mongodb is enabled + set: + mongodb: + enabled: true + hyperdx: + initContainer: + resources: + limits: + cpu: 1 + memory: 1Gi + requests: + cpu: 2 + memory: 2Gi + asserts: + - isNotEmpty: + path: spec.template.spec.initContainers + - equal: + path: spec.template.spec.initContainers[0].name + value: wait-for-mongodb + - isNotEmpty: + path: spec.template.spec.initContainers[0].resources + - equal: + path: spec.template.spec.initContainers[0].resources.limits + content: + cpu: 1 + memory: 1Gi + - equal: + path: spec.template.spec.initContainers[0].resources.requests + content: + cpu: 2 + memory: 2Gi + +- it: should not include initContainers resources when not configured and mongodb is enabled + set: + mongodb: + enabled: true + hyperdx: + initContainer: + asserts: + - isNotEmpty: + path: spec.template.spec.initContainers + - equal: + path: spec.template.spec.initContainers[0].name + value: wait-for-mongodb + - isEmpty: + path: spec.template.spec.initContainers[0].resources