From 7933fe006a054375978aba84a4bb3cc364807490 Mon Sep 17 00:00:00 2001 From: Akash LM Date: Mon, 20 May 2024 10:40:19 +0530 Subject: [PATCH] fix: password issue for external clickhouse --- charts/signoz/Chart.yaml | 2 +- charts/signoz/templates/_clickhouse.tpl | 37 +++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/charts/signoz/Chart.yaml b/charts/signoz/Chart.yaml index 9578a3f..76f6ec4 100644 --- a/charts/signoz/Chart.yaml +++ b/charts/signoz/Chart.yaml @@ -52,4 +52,4 @@ sources: - https://github.com/signoz/alertmanager - https://github.com/signoz/signoz-otel-collector type: application -version: 0.0.3 \ No newline at end of file +version: 0.0.4 \ No newline at end of file diff --git a/charts/signoz/templates/_clickhouse.tpl b/charts/signoz/templates/_clickhouse.tpl index f3f09c2..9071e8a 100644 --- a/charts/signoz/templates/_clickhouse.tpl +++ b/charts/signoz/templates/_clickhouse.tpl @@ -1,6 +1,15 @@ {{/* Common ClickHouse ENV variables and helpers used by SigNoz */}} + +{{- define "schemamigrator.url" -}} +{{- if .Values.clickhouse.enabled -}} +{{- printf "%v:%v" ( include "clickhouse.servicename" . ) ( include "clickhouse.tcpPort" . ) -}} +{{- else -}} +{{- printf "%v:%v" ( required "externalClickhouse.host is required if not clickhouse.enabled" .Values.externalClickhouse.host ) ( default 9000 .Values.externalClickhouse.tcpPort ) -}} +{{- end -}} +{{- end -}} + {{- define "snippet.clickhouse-env" }} {{- if .Values.clickhouse.enabled -}} - name: CLICKHOUSE_HOST @@ -59,7 +68,15 @@ Common ClickHouse ENV variables and helpers used by SigNoz Minimized ClickHouse ENV variables for user credentials */}} {{- define "snippet.clickhouse-credentials" }} -{{- if .Values.clickhouse.enabled -}} +{{ if .Values.clickhouse.enabled -}} +- name: CLICKHOUSE_HOST + value: {{ include "clickhouse.servicename" . }} +- name: CLICKHOUSE_PORT + value: {{ include "clickhouse.tcpPort" . | quote }} +- name: CLICKHOUSE_HTTP_PORT + value: {{ include "clickhouse.httpPort" . | quote }} +- name: CLICKHOUSE_CLUSTER + value: {{ .Values.clickhouse.cluster | quote }} - name: CLICKHOUSE_USER value: {{ .Values.clickhouse.user | quote }} - name: CLICKHOUSE_PASSWORD @@ -67,6 +84,14 @@ Minimized ClickHouse ENV variables for user credentials - name: CLICKHOUSE_SECURE value: {{ .Values.clickhouse.secure | quote }} {{- else -}} +- name: CLICKHOUSE_HOST + value: {{ required "externalClickhouse.host is required if not clickhouse.enabled" .Values.externalClickhouse.host | quote }} +- name: CLICKHOUSE_PORT + value: {{ default 9000 .Values.externalClickhouse.tcpPort | quote }} +- name: CLICKHOUSE_HTTP_PORT + value: {{ default 8123 .Values.externalClickhouse.httpPort | quote }} +- name: CLICKHOUSE_CLUSTER + value: {{ required "externalClickhouse.cluster is required if not clickhouse.enabled" .Values.externalClickhouse.cluster | quote }} - name: CLICKHOUSE_USER value: {{ .Values.externalClickhouse.user | quote }} {{- if .Values.externalClickhouse.existingSecret }} @@ -145,7 +170,7 @@ Return the ClickHouse secret key Return the external ClickHouse password */}} {{- define "clickhouse.externalPasswordKey" -}} -{{- if .Values.externalClickhouse.user }} +{{- if .Values.externalClickhouse.password }} {{- required "externalClickhouse.password is required if using external clickhouse" .Values.externalClickhouse.password -}} {{- end -}} {{- end -}} @@ -191,3 +216,11 @@ Return the ClickHouse Traces URL {{- required "externalClickhouse.host is required if using external clickhouse" .Values.externalClickhouse.host }}:{{ include "clickhouse.tcpPort" . }}?database={{ .Values.externalClickhouse.traceDatabase }}&username={{ .Values.externalClickhouse.user }}&password=$(CLICKHOUSE_PASSWORD) {{- end -}} {{- end -}} + +{{- define "clickhouse.clickHouseUrl" -}} +{{- if .Values.clickhouse.enabled -}} + {{- include "clickhouse.servicename" . }}:{{ include "clickhouse.tcpPort" . }}/?username={{ .Values.clickhouse.user }}&password={{ .Values.clickhouse.password -}} +{{- else -}} + {{- required "externalClickhouse.host is required if using external clickhouse" .Values.externalClickhouse.host }}:{{ include "clickhouse.tcpPort" . }}/?username={{ .Values.externalClickhouse.user }}&password=$(CLICKHOUSE_PASSWORD) +{{- end -}} +{{- end -}} \ No newline at end of file