Skip to content

Commit b9ae397

Browse files
committed
add support for external clickhouse connection
1 parent 0b0aa70 commit b9ae397

File tree

5 files changed

+99
-1
lines changed

5 files changed

+99
-1
lines changed

charts/client/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ dependencies:
3333
repository: https://intelops.github.io/kubviz/
3434
- name: grafana
3535
condition: grafana.enabled
36-
version: 1.0.4
36+
version: 1.0.5
3737
repository: https://kube-tarian.github.io/helmrepo-supporting-tools/
3838

charts/client/templates/configmap-clickhouse-datasource.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,23 @@ data:
1313
type: grafana-clickhouse-datasource
1414
jsonData:
1515
port: 9000
16+
{{- if .Values.clickhouse.enabled }}
1617
server: {{ include "client.fullname" . }}-clickhouse
18+
{{- else }}
19+
server: {{ .Values.existingClickhouse.host }}
1720
tlsSkipVerify: true
21+
{{- if not .Values.clickhouse.enabled }}
22+
{{- if not .Values.existingClickhouse.secret }}
23+
username: {{ .Values.existingClickhouse.username }}
24+
{{- else }}
25+
username: $CLICKHOUSE_USERNAME
26+
{{- end }}
27+
secureJsonData:
28+
{{- if not .Values.existingClickhouse.secret }}
29+
password: {{ .Values.existingClickhouse.password }}
30+
{{- else }}
31+
password: $CLICKHOUSE_PASSWORD
32+
{{- end }}
33+
{{- end }}
34+
{{- end }}
1835
{{- end }}

charts/client/templates/configmap-vertamedia-datasource.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@ data:
1111
datasources:
1212
- name: vertamedia-clickhouse-datasource
1313
type: vertamedia-clickhouse-datasource
14+
{{- if .Values.clickhouse.enabled }}
1415
url: {{ include "client.fullname" . }}-clickhouse:8123
16+
{{- else }}
17+
url: {{ .Values.existingClickhouse.host }}:8123
1518
access: proxy
19+
{{- if not .Values.clickhouse.enabled }}
20+
basicAuth: true
21+
{{- if not .Values.existingClickhouse.secret }}
22+
basicAuthUser: {{ .Values.existingClickhouse.username }}
23+
{{- else }}
24+
basicAuthUser: $CLICKHOUSE_USERNAME
25+
{{- end }}
26+
secureJsonData:
27+
{{- if not .Values.existingClickhouse.secret }}
28+
basicAuthPassword: {{ .Values.existingClickhouse.password }}
29+
{{- else }}
30+
basicAuthPassword: $CLICKHOUSE_PASSWORD
31+
{{- end }}
32+
{{- end }}
33+
{{- end }}
1634
{{- end }}

charts/client/templates/deployment.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,29 @@ spec:
4040
- name: SCHEMA_PATH
4141
value : {{ .Values.migration.schema.path }}
4242
- name: DB_ADDRESS
43+
{{- if .Values.clickhouse.enabled }}
4344
value: {{ include "client.fullname" . }}-clickhouse
45+
{{- else }}
46+
value: {{ .Values.existingClickhouse.host }}
47+
- name: CLICKHOUSE_USERNAME
48+
{{- if not .Values.existingClickhouse.secret }}
49+
value: {{ .Values.existingClickhouse.username }}
50+
{{- else }}
51+
valueFrom:
52+
secretKeyRef:
53+
name: {{ .Values.existingClickhouse.secret.name }}
54+
key: {{ .Values.existingClickhouse.secret.usernamekey }}
55+
{{- end }}
56+
- name: CLICKHOUSE_PASSWORD
57+
{{- if not .Values.existingClickhouse.secret }}
58+
value: {{ .Values.existingClickhouse.password }}
59+
{{- else }}
60+
valueFrom:
61+
secretKeyRef:
62+
name: {{ .Values.existingClickhouse.secret.name }}
63+
key: {{ .Values.existingClickhouse.secret.passwordkey }}
64+
{{- end }}
65+
{{- end }}
4466
- name: DB_PORT
4567
value: "9000"
4668
containers:
@@ -74,7 +96,29 @@ spec:
7496
- name: NATS_ADDRESS
7597
value: {{ include "client.fullname" . }}-nats
7698
- name: DB_ADDRESS
99+
{{- if .Values.clickhouse.enabled }}
77100
value: {{ include "client.fullname" . }}-clickhouse
101+
{{- else }}
102+
value: {{ .Values.existingClickhouse.host }}
103+
- name: CLICKHOUSE_USERNAME
104+
{{- if not .Values.existingClickhouse.secret }}
105+
value: {{ .Values.existingClickhouse.username }}
106+
{{- else }}
107+
valueFrom:
108+
secretKeyRef:
109+
name: {{ .Values.existingClickhouse.secret.name }}
110+
key: {{ .Values.existingClickhouse.secret.usernamekey }}
111+
{{- end }}
112+
- name: CLICKHOUSE_PASSWORD
113+
{{- if not .Values.existingClickhouse.secret }}
114+
value: {{ .Values.existingClickhouse.password }}
115+
{{- else }}
116+
valueFrom:
117+
secretKeyRef:
118+
name: {{ .Values.existingClickhouse.secret.name }}
119+
key: {{ .Values.existingClickhouse.secret.passwordkey }}
120+
{{- end }}
121+
{{- end }}
78122
- name: DB_PORT
79123
value: "9000"
80124
resources:

charts/client/values.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@ clickhouse:
9898
clickhouse:
9999
replicas: "1"
100100

101+
existingClickhouse:
102+
host: clickhouse
103+
# Use username and password if you want to provide the token via Helm Values
104+
username: ""
105+
password: ""
106+
# Use a secret reference if you want to get a username and password from a secret
107+
secret: {}
108+
# name: ""
109+
# usernamekey: ""
110+
# passwordkey: ""
111+
101112
grafana:
102113
enabled: false
103114
plugins:
@@ -122,6 +133,14 @@ grafana:
122133
mountPath: /etc/secrets/postgresql
123134
secretName: kubviz-client-postgresql
124135
readOnly: true
136+
clickhouse:
137+
enabled: false
138+
username: ""
139+
password: ""
140+
existingSecret: {}
141+
# name: ""
142+
# usernamekey: ""
143+
# passwordkey: ""
125144

126145
dashboards:
127146
enabled: true

0 commit comments

Comments
 (0)