Skip to content

Commit

Permalink
chore: support clickhouse 22.9.4 (#1376)
Browse files Browse the repository at this point in the history
Co-authored-by: loomts <[email protected]>
  • Loading branch information
loomts and loomts authored Dec 27, 2024
1 parent e97d07c commit 47738ac
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ KubeBlocks add-ons.
| ---- | ---- | ----------- | ----------- |
| apecloud-mysql | apecloud-mysql-8.0.30<br>wescale-0.2.7 | ApeCloud MySQL is a database that is compatible with MySQL syntax and achieves high availability through the utilization of the RAFT consensus protocol. | xuriwuyun |
| apecloud-postgresql | apecloud-postgresql-14.11.0 | ApeCloud PostgreSQL is a database that is compatible with PostgreSQL syntax and achieves high availability through the utilization of the RAFT consensus protocol. | ldming |
| clickhouse | clickhouse-24.8.3 | ClickHouse is an open-source column-oriented OLAP database management system. Use it to boost your database performance while providing linear scalability and hardware efficiency. | sophon-zt |
| clickhouse | clickhouse-22.9.4<br>clickhouse-24.8.3 | ClickHouse is an open-source column-oriented OLAP database management system. Use it to boost your database performance while providing linear scalability and hardware efficiency. | sophon-zt |
| elasticsearch | elasticsearch-7.10.1<br>elasticsearch-7.7.1<br>elasticsearch-7.8.1<br>elasticsearch-8.1.3<br>elasticsearch-8.8.2 | Elasticsearch is a distributed, RESTful search engine optimized for speed and relevance on production-scale workloads. | iziang |
| etcd | etcd-3.5.15<br>etcd-3.5.6 | Etcd is a strongly consistent, distributed key-value store that provides a reliable way to store data that needs to be accessed by a distributed system or cluster of machines. | free6om |
| greptimedb | greptimedb-0.3.2 | An open-source, cloud-native, distributed time-series database with PromQL/SQL/Python supported. | GreptimeTeam sh2 |
Expand Down
16 changes: 10 additions & 6 deletions addons-cluster/clickhouse/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ Define clickhouse componentSpec with ComponentDefinition.
{{- define "clickhouse-component" -}}
- name: clickhouse
componentDef: clickhouse-24
replicas: {{ $.Values.replicaCount | default 2 }}
replicas: {{ $.Values.replicas | default 2 }}
disableExporter: {{ $.Values.disableExporter | default "false" }}
serviceVersion: {{ $.Values.version }}
serviceAccountName: {{ include "clickhouse-cluster.serviceAccountName" $ }}
systemAccounts:
- name: admin
Expand All @@ -110,8 +111,9 @@ Define clickhouse keeper componentSpec with ComponentDefinition.
{{- define "clickhouse-keeper-component" -}}
- name: ch-keeper
componentDef: clickhouse-keeper-24
replicas: {{ .Values.keeper.replicaCount }}
replicas: {{ .Values.keeper.replicas }}
disableExporter: {{ $.Values.disableExporter | default "false" }}
serviceVersion: {{ $.Values.version }}
{{- with .Values.keeper.tolerations }}
tolerations: {{ .| toYaml | nindent 4 }}
{{- end }}
Expand Down Expand Up @@ -149,12 +151,13 @@ Define clickhouse shardingComponentSpec with ComponentDefinition.
*/}}
{{- define "clickhouse-sharding-component" -}}
- name: shard
shards: {{ .Values.shardCount }}
shards: {{ .Values.shards }}
template:
name: clickhouse
componentDef: clickhouse-24
replicas: {{ $.Values.replicaCount | default 2 }}
replicas: {{ $.Values.replicas | default 2 }}
disableExporter: {{ $.Values.disableExporter | default "false" }}
serviceVersion: {{ $.Values.version }}
serviceAccountName: {{ include "clickhouse-cluster.serviceAccountName" $ }}
systemAccounts:
- name: admin
Expand All @@ -176,11 +179,12 @@ Define clickhouse shardingComponentSpec with ComponentDefinition.
Define clickhouse componentSpec with compatible ComponentDefinition API
*/}}
{{- define "clickhouse-nosharding-component" -}}
{{- range $i := until (.Values.shardCount | int) }}
{{- range $i := until (.Values.shards | int) }}
- name: shard-{{ $i }}
componentDef: clickhouse-24
replicas: {{ $.Values.replicaCount | default 2 }}
replicas: {{ $.Values.replicas | default 2 }}
disableExporter: {{ $.Values.disableExporter | default "false" }}
serviceVersion: {{ $.Values.version }}
serviceAccountName: {{ include "clickhouse-cluster.serviceAccountName" $ }}
{{- with $.Values.tolerations }}
tolerations: {{ .| toYaml | nindent 4 }}
Expand Down
8 changes: 4 additions & 4 deletions addons-cluster/clickhouse/templates/cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{{- include "kblib.clusterCommon" . }}
{{- if eq (.Values.shardCount | int) 1 }}
{{- if eq (.Values.shards | int) 1 }}
clusterDef: clickhouse
topology: {{ .Values.mode }}
{{- end }}
componentSpecs:
{{- if eq .Values.mode "cluster" }}
{{- include "clickhouse-keeper-component" . | nindent 4 }}
{{- end }}
{{- if eq (.Values.shardCount | int) 1 }}
{{- if eq (.Values.shards | int) 1 }}
{{- include "clickhouse-component" . | nindent 4 }}
{{- end }}
{{- if gt (.Values.shardCount | int) 1 }}
{{- if not .Values.sharding.enabled }}
{{- if gt (.Values.shards | int) 1 }}
{{- if not .Values.sharding }}
{{- include "clickhouse-nosharding-component" . | nindent 4 }}
{{- else }}
shardings:
Expand Down
6 changes: 3 additions & 3 deletions addons-cluster/clickhouse/templates/validate.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.keeper.replicaCount }}
{{- if ne (mod (int .Values.keeper.replicaCount) 2) 1 }}
{{ fail "Zookeeper cluster does not support running with even number replicas." }}
{{- if .Values.keeper.replicas }}
{{- if ne (mod (int .Values.keeper.replicas) 2) 1 }}
{{ fail "Clickhouse keeper does not support running with even number replicas." }}
{{- end }}
{{- end }}
25 changes: 12 additions & 13 deletions addons-cluster/clickhouse/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
"title": "ClickHouse Cluster Configuration",
"description": "Configuration schema for the ClickHouse Helm chart.",
"properties": {
"version": {
"title": "ClickHouse Cluster Version",
"description": "Engine Version of the ClickHouse cluster.",
"type": "string",
"default": "24.8.3"
},
"mode": {
"title": "Cluster Topology Mode",
"description": "Define the ClickHouse cluster topology mode.",
Expand All @@ -14,7 +20,7 @@
"cluster"
]
},
"shardCount": {
"shards": {
"title": "Shard Count",
"description": "Number of shards in the ClickHouse cluster.",
"type": "integer",
Expand All @@ -23,18 +29,11 @@
},
"sharding": {
"title": "Sharding Configuration",
"description": "Settings related to sharding within the ClickHouse cluster.",
"type": "object",
"properties": {
"enabled": {
"title": "Sharding Enabled",
"description": "Enable or disable sharding.",
"type": "boolean",
"default": false
}
}
"description": "Enable or disable sharding within the ClickHouse cluster.",
"type": "boolean",
"default": true
},
"replicaCount": {
"replicas": {
"title": "Replica Count",
"description": "Number of replicas per shard.",
"type": "integer",
Expand Down Expand Up @@ -85,7 +84,7 @@
"description": "Settings for the ClickHouse Keeper (coordinator).",
"type": "object",
"properties": {
"replicaCount": {
"replicas": {
"title": "Keeper Replica Count",
"description": "Number of ClickHouse Keeper replicas.",
"type": "integer",
Expand Down
12 changes: 7 additions & 5 deletions addons-cluster/clickhouse/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ nameOverride: ""
# Override the full name of the chart
fullnameOverride: ""

## Clickhouse cluster version
version: 24.8.3

## ClickHouse cluster topology mode defined in ClusterDefinition.Spec.topologies, support standalone and cluster
## - `standalone`: single clickhouse instance
## - `cluster`: clickhouse with ClickHouse Keeper as coordinator
mode: cluster

## Sharding configuration
shardCount: 1
sharding:
enabled: false
shards: 1
sharding: true

## Number of ClickHouse replicas per shard to deploy
replicaCount: 2
replicas: 2

## ClickHouse per shard component configurations
cpu: 1
Expand All @@ -36,7 +38,7 @@ tolerations: []
## ClickHouse Keeper configuration
keeper:
## Number of ClickHouse Keeper replicas
replicaCount: 1
replicas: 1
storageClassName: ""
cpu: 1
memory: 2
Expand Down
9 changes: 8 additions & 1 deletion addons/clickhouse/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,12 @@ Define clickhouse image repository
Define clickhouse24 image
*/}}
{{- define "clickhouse24.image" -}}
{{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
{{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag.major24 }}
{{- end }}

{{/*
Define clickhouse22 image
*/}}
{{- define "clickhouse22.image" -}}
{{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag.major22 }}
{{- end }}
6 changes: 6 additions & 0 deletions addons/clickhouse/templates/cmpv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ spec:
compatibilityRules:
- releases:
- 24.8.3
- 22.9.4
compDefs:
- {{ include "clickhouse24.cmpdRegexpPattern" . }}
- releases:
- 24.8.3
- 22.9.4
compDefs:
- {{ include "clickhouse-keeper24.cmpdRegexpPattern" . }}
releases:
- name: 24.8.3
serviceVersion: 24.8.3
images:
clickhouse: {{ include "clickhouse.repository" . }}:24.8.3-debian-12-r1
- name: 22.9.4
serviceVersion: 22.9.4
images:
clickhouse: {{ include "clickhouse.repository" . }}:22.9.4-debian-11-r1
4 changes: 3 additions & 1 deletion addons/clickhouse/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ image:
repository: bitnami/clickhouse
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: 24.8.3-debian-12-r1
tag:
major24: 24.8.3-debian-12-r1
major22: 22.9.4-debian-11-r1

0 comments on commit 47738ac

Please sign in to comment.