Skip to content

Commit

Permalink
add support for external clickhouse connection
Browse files Browse the repository at this point in the history
  • Loading branch information
akash4sh committed Nov 8, 2023
1 parent 0b0aa70 commit b9ae397
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/client/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ dependencies:
repository: https://intelops.github.io/kubviz/
- name: grafana
condition: grafana.enabled
version: 1.0.4
version: 1.0.5
repository: https://kube-tarian.github.io/helmrepo-supporting-tools/

17 changes: 17 additions & 0 deletions charts/client/templates/configmap-clickhouse-datasource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ data:
type: grafana-clickhouse-datasource
jsonData:
port: 9000
{{- if .Values.clickhouse.enabled }}
server: {{ include "client.fullname" . }}-clickhouse
{{- else }}
server: {{ .Values.existingClickhouse.host }}
tlsSkipVerify: true
{{- if not .Values.clickhouse.enabled }}
{{- if not .Values.existingClickhouse.secret }}
username: {{ .Values.existingClickhouse.username }}
{{- else }}
username: $CLICKHOUSE_USERNAME
{{- end }}
secureJsonData:
{{- if not .Values.existingClickhouse.secret }}
password: {{ .Values.existingClickhouse.password }}
{{- else }}
password: $CLICKHOUSE_PASSWORD
{{- end }}
{{- end }}
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/client/templates/configmap-vertamedia-datasource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ data:
datasources:
- name: vertamedia-clickhouse-datasource
type: vertamedia-clickhouse-datasource
{{- if .Values.clickhouse.enabled }}
url: {{ include "client.fullname" . }}-clickhouse:8123
{{- else }}
url: {{ .Values.existingClickhouse.host }}:8123
access: proxy
{{- if not .Values.clickhouse.enabled }}
basicAuth: true
{{- if not .Values.existingClickhouse.secret }}
basicAuthUser: {{ .Values.existingClickhouse.username }}
{{- else }}
basicAuthUser: $CLICKHOUSE_USERNAME
{{- end }}
secureJsonData:
{{- if not .Values.existingClickhouse.secret }}
basicAuthPassword: {{ .Values.existingClickhouse.password }}
{{- else }}
basicAuthPassword: $CLICKHOUSE_PASSWORD
{{- end }}
{{- end }}
{{- end }}
{{- end }}
44 changes: 44 additions & 0 deletions charts/client/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,29 @@ spec:
- name: SCHEMA_PATH
value : {{ .Values.migration.schema.path }}
- name: DB_ADDRESS
{{- if .Values.clickhouse.enabled }}
value: {{ include "client.fullname" . }}-clickhouse
{{- else }}
value: {{ .Values.existingClickhouse.host }}
- name: CLICKHOUSE_USERNAME
{{- if not .Values.existingClickhouse.secret }}
value: {{ .Values.existingClickhouse.username }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.existingClickhouse.secret.name }}
key: {{ .Values.existingClickhouse.secret.usernamekey }}
{{- end }}
- name: CLICKHOUSE_PASSWORD
{{- if not .Values.existingClickhouse.secret }}
value: {{ .Values.existingClickhouse.password }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.existingClickhouse.secret.name }}
key: {{ .Values.existingClickhouse.secret.passwordkey }}
{{- end }}
{{- end }}
- name: DB_PORT
value: "9000"
containers:
Expand Down Expand Up @@ -74,7 +96,29 @@ spec:
- name: NATS_ADDRESS
value: {{ include "client.fullname" . }}-nats
- name: DB_ADDRESS
{{- if .Values.clickhouse.enabled }}
value: {{ include "client.fullname" . }}-clickhouse
{{- else }}
value: {{ .Values.existingClickhouse.host }}
- name: CLICKHOUSE_USERNAME
{{- if not .Values.existingClickhouse.secret }}
value: {{ .Values.existingClickhouse.username }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.existingClickhouse.secret.name }}
key: {{ .Values.existingClickhouse.secret.usernamekey }}
{{- end }}
- name: CLICKHOUSE_PASSWORD
{{- if not .Values.existingClickhouse.secret }}
value: {{ .Values.existingClickhouse.password }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.existingClickhouse.secret.name }}
key: {{ .Values.existingClickhouse.secret.passwordkey }}
{{- end }}
{{- end }}
- name: DB_PORT
value: "9000"
resources:
Expand Down
19 changes: 19 additions & 0 deletions charts/client/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ clickhouse:
clickhouse:
replicas: "1"

existingClickhouse:
host: clickhouse
# Use username and password if you want to provide the token via Helm Values
username: ""
password: ""
# Use a secret reference if you want to get a username and password from a secret
secret: {}
# name: ""
# usernamekey: ""
# passwordkey: ""

grafana:
enabled: false
plugins:
Expand All @@ -122,6 +133,14 @@ grafana:
mountPath: /etc/secrets/postgresql
secretName: kubviz-client-postgresql
readOnly: true
clickhouse:
enabled: false
username: ""
password: ""
existingSecret: {}
# name: ""
# usernamekey: ""
# passwordkey: ""

dashboards:
enabled: true
Expand Down

0 comments on commit b9ae397

Please sign in to comment.