Skip to content

Commit 482c19c

Browse files
committed
updated Clickhouse chart
1 parent a61956c commit 482c19c

37 files changed

+3045
-1451
lines changed

.github/workflows/helm_release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
- name: Add Helm repos
2424
run: |
2525
helm repo add tools https://kube-tarian.github.io/helmrepo-supporting-tools
26+
helm repo add bitnami https://charts.bitnami.com/bitnami
2627
2728
- name: Run chart-releaser
2829
uses: helm/[email protected]

charts/clickhouse/.helmignore

100755100644
File mode changed.

charts/clickhouse/Chart.yaml

100755100644
Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
appVersion: "19.14"
2-
description: ClickHouse is an open source column-oriented database management system
3-
capable of real time generation of analytical data reports using SQL queries
4-
home: https://clickhouse.yandex/
5-
icon: https://clickhouse.yandex/images/logo.png
1+
apiVersion: v2
2+
appVersion: 23.10.5
3+
dependencies:
4+
- name: common
5+
repository: https://charts.bitnami.com/bitnami
6+
tags:
7+
- bitnami-common
8+
version: 2.x.x
9+
description: ClickHouse is an open-source column-oriented OLAP database management
10+
system. Use it to boost your database performance while providing linear scalability
11+
and hardware efficiency.
12+
home: https://bitnami.com
13+
icon: https://bitnami.com/assets/stacks/clickhouse/img/clickhouse-stack-220x234.png
614
keywords:
7-
- clickhouse
8-
- olap
915
- database
16+
- sharding
1017
maintainers:
11-
12-
name: liwenhe
18+
- name: VMware, Inc.
19+
url: https://github.com/bitnami/charts
1320
name: clickhouse
1421
sources:
15-
- https://github.com/liwenhe1993/charts
16-
version: 1.0.2
22+
- https://github.com/bitnami/charts/tree/main/bitnami/clickhouse
23+
version: 1.0.3

charts/clickhouse/README.md

100755100644
Lines changed: 506 additions & 146 deletions
Large diffs are not rendered by default.

charts/clickhouse/templates/NOTES.txt

100755100644
Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,58 @@
1-
** Please be patient while the chart is being deployed **
2-
3-
1. Get the Clickhouse URL by running:
4-
5-
{{- if .Values.clickhouse.ingress.enabled }}
6-
7-
export HOSTNAME=$(kubectl get ingress --namespace {{ .Release.Namespace }} {{ template "clickhouse.fullname" . }} -o jsonpath='{.spec.rules[0].host}')
8-
echo "Clickhouse URL: http://$HOSTNAME/"
9-
10-
{{- else }}
11-
12-
echo URL : http://127.0.0.1:8080/
13-
echo Management URL : http://127.0.0.1:8080/manager
14-
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "clickhouse.fullname" . }} 8123:{{ .Values.clickhouse.http_port }}
15-
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "clickhouse.fullname" . }} 9000:{{ .Values.clickhouse.tcp_port }}
16-
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "clickhouse.fullname" . }} 9009:{{ .Values.clickhouse.interserver_http_port }}
17-
18-
{{- end }}
19-
20-
2. Get the Tabix URL by running:
21-
22-
{{- if .Values.tabix.ingress.enabled }}
23-
24-
export HOSTNAME=$(kubectl get ingress --namespace {{ .Release.Namespace }} {{ template "clickhouse.fullname" . }}-tabix -o jsonpath='{.spec.rules[0].host}')
25-
echo "Tabix URL: http://$HOSTNAME/"
26-
27-
{{- else }}
28-
29-
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "clickhouse.fullname" . }}-tabix 80
30-
31-
{{- end }}
1+
CHART NAME: {{ .Chart.Name }}
2+
CHART VERSION: {{ .Chart.Version }}
3+
APP VERSION: {{ .Chart.AppVersion }}
4+
5+
** Please be patient while the chart is being deployed **
6+
7+
{{- if .Values.diagnosticMode.enabled }}
8+
The chart has been deployed in diagnostic mode. All probes have been disabled and the command has been overwritten with:
9+
10+
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 4 }}
11+
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 4 }}
12+
13+
Get the list of pods by executing:
14+
15+
kubectl get pods --namespace {{ include "common.names.namespace" . | quote }} -l app.kubernetes.io/instance={{ .Release.Name }}
16+
17+
Access the pod you want to debug by executing
18+
19+
kubectl exec --namespace {{ include "common.names.namespace" . | quote }} -ti <NAME OF THE POD> -- bash
20+
21+
In order to replicate the container startup scripts execute this command:
22+
23+
/opt/bitnami/scripts/clickhouse/entrypoint.sh /opt/bitnami/scripts/clickhouse/run.sh
24+
25+
{{- else }}
26+
27+
ClickHouse is available in the following address:
28+
29+
{{- if .Values.externalAccess.enabled }}
30+
31+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
32+
33+
kubectl get svc --namespace {{ template "common.names.namespace" . }} -l "app.kubernetes.io/name={{ template "common.names.fullname" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=clickhouse" -w
34+
35+
{{- else if (eq "LoadBalancer" .Values.service.type) }}
36+
37+
export SERVICE_IP=$(kubectl get svc --namespace {{ template "common.names.namespace" . }} {{ template "common.names.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
38+
39+
{{- else if (eq "NodePort" .Values.service.type)}}
40+
41+
export NODE_IP=$(kubectl get nodes --namespace {{ template "common.names.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
42+
export NODE_PORT=$(kubectl get --namespace {{ template "common.names.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "common.names.fullname" . }})
43+
44+
{{- else if (eq "ClusterIP" .Values.service.type)}}
45+
46+
kubectl port-forward --namespace {{ template "common.names.namespace" . }} svc/{{ template "common.names.fullname" . }} {{ .Values.service.ports.tcp }}:9000 &
47+
48+
{{- end }}
49+
50+
Credentials:
51+
52+
echo "Username : {{ .Values.auth.username }}"
53+
echo "Password : $(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "clickhouse.secretName" . }} -o jsonpath="{.data.{{ include "clickhouse.secretKey" .}}}" | base64 -d)"
54+
55+
{{- end }}
56+
57+
{{- include "common.warnings.rollingTag" .Values.image }}
58+
{{- include "clickhouse.validateValues" . }}

charts/clickhouse/templates/_helpers.tpl

100755100644
Lines changed: 192 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,219 @@
1-
{{/* vim: set filetype=mustache: */}}
21
{{/*
3-
Expand the name of the chart.
2+
Copyright VMware, Inc.
3+
SPDX-License-Identifier: APACHE-2.0
44
*/}}
5-
{{- define "clickhouse.name" -}}
6-
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
5+
6+
{{/*
7+
Return the proper ClickHouse image name
8+
*/}}
9+
{{- define "clickhouse.image" -}}
10+
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
711
{{- end -}}
812

913
{{/*
10-
Create a default fully qualified app name.
11-
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12-
If release name contains chart name it will be used as a full name.
14+
Return the proper image name (for the init container volume-permissions image)
15+
*/}}
16+
{{- define "clickhouse.volumePermissions.image" -}}
17+
{{- include "common.images.image" ( dict "imageRoot" .Values.volumePermissions.image "global" .Values.global ) -}}
18+
{{- end -}}
19+
20+
{{/*
21+
Return the proper Docker Image Registry Secret Names
22+
*/}}
23+
{{- define "clickhouse.imagePullSecrets" -}}
24+
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Return true if a TLS credentials secret object should be created
1329
*/}}
14-
{{- define "clickhouse.fullname" -}}
15-
{{- if .Values.fullnameOverride -}}
16-
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
30+
{{- define "clickhouse.createTlsSecret" -}}
31+
{{- if and .Values.tls.autoGenerated (not .Values.tls.certificatesSecret) }}
32+
{{- true -}}
33+
{{- end -}}
34+
{{- end -}}
35+
36+
{{/*
37+
Return the path to the CA cert file.
38+
*/}}
39+
{{- define "clickhouse.tlsSecretName" -}}
40+
{{- if .Values.tls.autoGenerated }}
41+
{{- printf "%s-crt" (include "common.names.fullname" .) -}}
1742
{{- else -}}
18-
{{- $name := default .Chart.Name .Values.nameOverride -}}
19-
{{- if contains $name .Release.Name -}}
20-
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
43+
{{ required "A secret containing TLS certificates is required when TLS is enabled" .Values.tls.certificatesSecret }}
44+
{{- end -}}
45+
{{- end -}}
46+
47+
{{/*
48+
Return the path to the cert file.
49+
*/}}
50+
{{- define "clickhouse.tlsCert" -}}
51+
{{- if .Values.tls.autoGenerated }}
52+
{{- printf "/opt/bitnami/clickhouse/certs/tls.crt" -}}
2153
{{- else -}}
22-
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
54+
{{- required "Certificate filename is required when TLS in enabled" .Values.tls.certFilename | printf "/opt/bitnami/clickhouse/certs/%s" -}}
55+
{{- end -}}
56+
{{- end -}}
57+
58+
{{/*
59+
Return the path to the cert key file.
60+
*/}}
61+
{{- define "clickhouse.tlsCertKey" -}}
62+
{{- if .Values.tls.autoGenerated }}
63+
{{- printf "/opt/bitnami/clickhouse/certs/tls.key" -}}
64+
{{- else -}}
65+
{{- required "Certificate Key filename is required when TLS in enabled" .Values.tls.certKeyFilename | printf "/opt/bitnami/clickhouse/certs/%s" -}}
66+
{{- end -}}
67+
{{- end -}}
68+
69+
{{/*
70+
Return the path to the CA cert file.
71+
*/}}
72+
{{- define "clickhouse.tlsCACert" -}}
73+
{{- if .Values.tls.autoGenerated }}
74+
{{- printf "/opt/bitnami/clickhouse/certs/ca.crt" -}}
75+
{{- else -}}
76+
{{- printf "/opt/bitnami/clickhouse/certs/%s" .Values.tls.certCAFilename -}}
77+
{{- end -}}
78+
{{- end -}}
79+
80+
{{/*
81+
Get the ClickHouse configuration configmap.
82+
*/}}
83+
{{- define "clickhouse.configmapName" -}}
84+
{{- if .Values.existingOverridesConfigmap -}}
85+
{{- .Values.existingOverridesConfigmap -}}
86+
{{- else }}
87+
{{- printf "%s" (include "common.names.fullname" . ) -}}
88+
{{- end -}}
89+
{{- end -}}
90+
91+
{{/*
92+
Get the ClickHouse configuration configmap.
93+
*/}}
94+
{{- define "clickhouse.extraConfigmapName" -}}
95+
{{- if .Values.extraOverridesConfigmap -}}
96+
{{- .Values.extraOverridesConfigmap -}}
97+
{{- else }}
98+
{{- printf "%s-extra" (include "common.names.fullname" . ) -}}
99+
{{- end -}}
23100
{{- end -}}
101+
102+
103+
{{/*
104+
Get the ClickHouse configuration users configmap.
105+
*/}}
106+
{{- define "clickhouse.usersExtraConfigmapName" -}}
107+
{{- if .Values.usersExtraOverridesConfigmap -}}
108+
{{- .Values.usersExtraOverridesConfigmap -}}
109+
{{- else }}
110+
{{- printf "%s-users-extra" (include "common.names.fullname" . ) -}}
111+
{{- end -}}
112+
{{- end -}}
113+
114+
{{/*
115+
Get the Clickhouse password secret name
116+
*/}}
117+
{{- define "clickhouse.secretName" -}}
118+
{{- if .Values.auth.existingSecret -}}
119+
{{- .Values.auth.existingSecret -}}
120+
{{- else }}
121+
{{- printf "%s" (include "common.names.fullname" . ) -}}
24122
{{- end -}}
25123
{{- end -}}
26124

27125
{{/*
28-
Create chart name and version as used by the chart label.
126+
Get the ClickHouse password key inside the secret
29127
*/}}
30-
{{- define "clickhouse.chart" -}}
31-
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
128+
{{- define "clickhouse.secretKey" -}}
129+
{{- if .Values.auth.existingSecret -}}
130+
{{- .Values.auth.existingSecretKey -}}
131+
{{- else }}
132+
{{- print "admin-password" -}}
133+
{{- end -}}
32134
{{- end -}}
33135

34136
{{/*
35-
Create clickhouse path.
36-
if .Values.clickhouse.path is empty, default value "/var/lib/clickhouse".
137+
Get the startialization scripts Secret name.
37138
*/}}
38-
{{- define "clickhouse.fullpath" -}}
39-
{{- if .Values.clickhouse.path -}}
40-
{{- .Values.clickhouse.path | trunc 63 | trimSuffix "-" -}}
139+
{{- define "clickhouse.startdbScriptsSecret" -}}
140+
{{- if .Values.startdbScriptsSecret -}}
141+
{{- printf "%s" (tpl .Values.startdbScriptsSecret $) -}}
41142
{{- else -}}
42-
{{- printf "%s" "/var/lib/clickhouse" -}}
143+
{{- printf "%s-start-scripts" (include "common.names.fullname" .) -}}
43144
{{- end -}}
44145
{{- end -}}
45146

46147
{{/*
47-
Create clickhouse log path.
48-
if .Values.clickhouse.configmap.logger.path is empty, default value "/var/log/clickhouse-server".
148+
Get the initialization scripts Secret name.
49149
*/}}
50-
{{- define "clickhouse.logpath" -}}
51-
{{- if .Values.clickhouse.configmap.logger.path -}}
52-
{{- .Values.clickhouse.configmap.logger.path | trunc 63 | trimSuffix "-" -}}
150+
{{- define "clickhouse.initdbScriptsSecret" -}}
151+
{{- if .Values.initdbScriptsSecret -}}
152+
{{- printf "%s" (tpl .Values.initdbScriptsSecret $) -}}
53153
{{- else -}}
54-
{{- printf "%s" "/var/log/clickhouse-server" -}}
154+
{{- printf "%s-init-scripts" (include "common.names.fullname" .) -}}
155+
{{- end -}}
156+
{{- end -}}
157+
158+
{{/*
159+
Return the path to the CA cert file.
160+
*/}}
161+
{{- define "clickhouse.headlessServiceName" -}}
162+
{{- printf "%s-headless" (include "common.names.fullname" .) -}}
163+
{{- end -}}
164+
165+
{{/*
166+
Create a default fully qualified app name.
167+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
168+
*/}}
169+
{{- define "clickhouse.zookeeper.fullname" -}}
170+
{{- include "common.names.dependency.fullname" (dict "chartName" "zookeeper" "chartValues" .Values.zookeeper "context" $) -}}
171+
{{- end -}}
172+
173+
{{/*
174+
Return the path to the CA cert file.
175+
*/}}
176+
{{- define "clickhouse.zookeeper.headlessServiceName" -}}
177+
{{- printf "%s-headless" (include "clickhouse.zookeeper.fullname" .) -}}
178+
{{- end -}}
179+
180+
{{/*
181+
Create the name of the service account to use
182+
*/}}
183+
{{- define "clickhouse.serviceAccountName" -}}
184+
{{- if .Values.serviceAccount.create -}}
185+
{{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
186+
{{- else -}}
187+
{{ default "default" .Values.serviceAccount.name }}
188+
{{- end -}}
189+
{{- end -}}
190+
191+
{{/*
192+
Compile all warnings into a single message.
193+
*/}}
194+
{{- define "clickhouse.validateValues" -}}
195+
{{- $messages := list -}}
196+
{{- $messages := append $messages (include "clickhouse.validateValues.zookeeper" .) -}}
197+
{{- $messages := without $messages "" -}}
198+
{{- $message := join "\n" $messages -}}
199+
200+
{{- if $message -}}
201+
{{- printf "\nVALUES VALIDATION:\n%s" $message -}}
202+
{{- end -}}
203+
{{- end -}}
204+
205+
{{/* Validate values of ClickHouse - [Zoo]keeper */}}
206+
{{- define "clickhouse.validateValues.zookeeper" -}}
207+
{{- if or (and .Values.keeper.enabled .Values.zookeeper.enabled) (and .Values.keeper.enabled .Values.externalZookeeper.servers) (and .Values.zookeeper.enabled .Values.externalZookeeper.servers) -}}
208+
clickhouse: Multiple [Zoo]keeper
209+
You can only use one [zoo]keeper
210+
Please choose use ClickHouse keeper or
211+
installing a Zookeeper chart (--set zookeeper.enabled=true) or
212+
using an external instance (--set zookeeper.servers )
213+
{{- end -}}
214+
{{- if and (not .Values.keeper.enabled) (not .Values.zookeeper.enabled) (not .Values.externalZookeeper.servers) (ne (int .Values.shards) 1) (ne (int .Values.replicaCount) 1) -}}
215+
clickhouse: No [Zoo]keeper
216+
If you are deploying more than one ClickHouse instance, you need to enable [Zoo]keeper. Please choose installing a [Zoo]keeper (--set keeper.enabled=true) or (--set zookeeper.enabled=true) or
217+
using an external instance (--set zookeeper.servers )
55218
{{- end -}}
56219
{{- end -}}

0 commit comments

Comments
 (0)