openreplay/scripts/helmcharts/databases/charts/clickhouse/templates/clickhouse-cluster.yaml
rjshrjndrn 192b95281b chore(helm): Add clickhouse topology support
Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
2022-07-11 08:58:04 +02:00

113 lines
4.5 KiB
YAML

apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: "openreplay-clickhouse"
spec:
defaults:
templates:
dataVolumeClaimTemplate: default
podTemplate: clickhouse:19.6
serviceTemplate: chi-service-template
configuration:
# Ref: https://github.com/Altinity/clickhouse-operator/issues/823
users:
default/networks/ip: "::/0"
zookeeper:
nodes:
- host: "{{ .Values.global.kafka.zookeeperHost }}"
port: {{ .Values.global.kafka.zookeeperNonTLSPort }}
clusters:
- name: replicated
layout:
shardsCount: {{ .Values.clickhouse.replicaCount }}
replicasCount: {{ .Values.clickhouse.shardsCount }}
templates:
volumeClaimTemplates:
- name: default
reclaimPolicy: Retain
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "{{ .Values.storage.size }}"
podTemplates:
- name: clickhouse:19.6
spec:
containers:
- name: clickhouse-pod
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
resources:
{{ toYaml .Values.resources | nindent 16 }}
nodeSelector:
{{- toYaml .Values.nodeSelector | nindent 12}}
tolerations:
{{- toYaml .Values.tolerations | nindent 12}}
# Ref: https://github.com/Altinity/clickhouse-operator/blob/master/docs/custom_resource_explained.md#spectemplatesservicetemplates
serviceTemplates:
- name: chi-service-template
# generateName understands different sets of macroses,
# depending on the level of the object, for which Service is being created:
#
# For CHI-level Service:
# 1. {chi} - ClickHouseInstallation name
# 2. {chiID} - short hashed ClickHouseInstallation name (BEWARE, this is an experimental feature)
#
# For Cluster-level Service:
# 1. {chi} - ClickHouseInstallation name
# 2. {chiID} - short hashed ClickHouseInstallation name (BEWARE, this is an experimental feature)
# 3. {cluster} - cluster name
# 4. {clusterID} - short hashed cluster name (BEWARE, this is an experimental feature)
# 5. {clusterIndex} - 0-based index of the cluster in the CHI (BEWARE, this is an experimental feature)
#
# For Shard-level Service:
# 1. {chi} - ClickHouseInstallation name
# 2. {chiID} - short hashed ClickHouseInstallation name (BEWARE, this is an experimental feature)
# 3. {cluster} - cluster name
# 4. {clusterID} - short hashed cluster name (BEWARE, this is an experimental feature)
# 5. {clusterIndex} - 0-based index of the cluster in the CHI (BEWARE, this is an experimental feature)
# 6. {shard} - shard name
# 7. {shardID} - short hashed shard name (BEWARE, this is an experimental feature)
# 8. {shardIndex} - 0-based index of the shard in the cluster (BEWARE, this is an experimental feature)
#
# For Replica-level Service:
# 1. {chi} - ClickHouseInstallation name
# 2. {chiID} - short hashed ClickHouseInstallation name (BEWARE, this is an experimental feature)
# 3. {cluster} - cluster name
# 4. {clusterID} - short hashed cluster name (BEWARE, this is an experimental feature)
# 5. {clusterIndex} - 0-based index of the cluster in the CHI (BEWARE, this is an experimental feature)
# 6. {shard} - shard name
# 7. {shardID} - short hashed shard name (BEWARE, this is an experimental feature)
# 8. {shardIndex} - 0-based index of the shard in the cluster (BEWARE, this is an experimental feature)
# 9. {replica} - replica name
# 10. {replicaID} - short hashed replica name (BEWARE, this is an experimental feature)
# 11. {replicaIndex} - 0-based index of the replica in the shard (BEWARE, this is an experimental feature)
generateName: "clickhouse-{chi}"
# type ObjectMeta struct from k8s.io/meta/v1
metadata:
labels:
installation: "openreplay"
spec:
ports:
- name: http
port: 8123
- name: client
port: 9000
type: ClusterIP
- name: cluster-template
generateName: "clickhouse"
metadata:
labels:
installation: "openreplay"
spec:
ports:
- name: http
port: 8123
- name: client
port: 9000
type: ClusterIP