diff --git a/charts/hdx-oss-v2/templates/otel-collector-deployment.yaml b/charts/hdx-oss-v2/templates/otel-collector-deployment.yaml index 3523ea4..fd14368 100644 --- a/charts/hdx-oss-v2/templates/otel-collector-deployment.yaml +++ b/charts/hdx-oss-v2/templates/otel-collector-deployment.yaml @@ -28,8 +28,8 @@ spec: - containerPort: {{ .Values.otel.httpPort }} - containerPort: {{ .Values.otel.healthPort }} env: - - name: CLICKHOUSE_SERVER_ENDPOINT - value: "{{ include "hdx-oss.fullname" . }}-clickhouse:{{ .Values.clickhouse.nativePort }}" + - name: CLICKHOUSE_ENDPOINT + value: "{{ .Values.otel.clickhouseEndpoint | default (printf "tcp://%s-clickhouse:%v?dial_timeout=10s" (include "hdx-oss.fullname" .) .Values.clickhouse.nativePort) }}" - name: HYPERDX_LOG_LEVEL value: {{ .Values.hyperdx.logLevel }} - name: CLICKHOUSE_USER diff --git a/charts/hdx-oss-v2/tests/__snapshot__/otel-collector-disabled_test.yaml.snap b/charts/hdx-oss-v2/tests/__snapshot__/otel-collector-disabled_test.yaml.snap index be43a61..db6d463 100644 --- a/charts/hdx-oss-v2/tests/__snapshot__/otel-collector-disabled_test.yaml.snap +++ b/charts/hdx-oss-v2/tests/__snapshot__/otel-collector-disabled_test.yaml.snap @@ -27,7 +27,7 @@ should render OTEL collector with custom ports: spec: containers: - env: - - name: CLICKHOUSE_SERVER_ENDPOINT + - name: CLICKHOUSE_ENDPOINT value: RELEASE-NAME-hdx-oss-v2-clickhouse:9000 - name: HYPERDX_LOG_LEVEL value: info diff --git a/charts/hdx-oss-v2/tests/otel-collector-custom-clickhouse_test.yaml b/charts/hdx-oss-v2/tests/otel-collector-custom-clickhouse_test.yaml new file mode 100644 index 0000000..c022274 --- /dev/null +++ b/charts/hdx-oss-v2/tests/otel-collector-custom-clickhouse_test.yaml @@ -0,0 +1,38 @@ +suite: test OTEL collector with custom clickhouse endpoint +templates: + - otel-collector-deployment.yaml +tests: + - it: should use default Clickhouse endpoint when not specified + set: + otel: + enabled: true + asserts: + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].env[0].name + value: CLICKHOUSE_ENDPOINT + - documentIndex: 0 + matchRegex: + path: spec.template.spec.containers[0].env[0].value + pattern: "tcp://.*-clickhouse:[0-9]+\\?dial_timeout=10s" + + - it: should use custom Clickhouse endpoint when specified + set: + otel: + enabled: true + clickhouseEndpoint: "my-custom-clickhouse:9000" + asserts: + - documentIndex: 0 + isKind: + of: Deployment + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].env[0].name + value: CLICKHOUSE_ENDPOINT + - documentIndex: 0 + equal: + path: spec.template.spec.containers[0].env[0].value + value: "my-custom-clickhouse:9000" \ No newline at end of file diff --git a/charts/hdx-oss-v2/values.yaml b/charts/hdx-oss-v2/values.yaml index c7dbb0f..4187832 100644 --- a/charts/hdx-oss-v2/values.yaml +++ b/charts/hdx-oss-v2/values.yaml @@ -60,6 +60,8 @@ otel: httpPort: 4318 healthPort: 8888 enabled: true + # Clickhouse endpoint - defaults to built-in Clickhouse service + clickhouseEndpoint: "" persistence: mongodb: