diff --git a/charts/portkey-app/templates/_helpers.tpl b/charts/portkey-app/templates/_helpers.tpl
index 941d7c4..ce51f9c 100644
--- a/charts/portkey-app/templates/_helpers.tpl
+++ b/charts/portkey-app/templates/_helpers.tpl
@@ -552,6 +552,40 @@ Template containing common environment variables that are used by several servic
{{- end -}}
{{- end -}}
+{{- define "clickhouse.replicationEnabled" -}}
+{{- if and (not .Values.clickhouse.external.enabled) (or .Values.clickhouseKeeper.enabled .Values.clickhouseKeeper.external.enabled) -}}
+true
+{{- end -}}
+{{- end -}}
+
+{{- define "clickhouse.shardingEnabled" -}}
+{{- if and (include "clickhouse.replicationEnabled" .) .Values.clickhouse.sharding.enabled -}}
+true
+{{- end -}}
+{{- end -}}
+
+{{- define "clickhouse.headlessServiceName" -}}
+{{- printf "%s-%s-headless" (include "portkey.fullname" .) .Values.clickhouse.name -}}
+{{- end -}}
+
+{{- define "clickhouseKeeper.deployEnabled" -}}
+{{- if and .Values.clickhouseKeeper.enabled (not .Values.clickhouseKeeper.external.enabled) -}}
+true
+{{- end -}}
+{{- end -}}
+
+{{- define "clickhouseKeeper.headlessServiceName" -}}
+{{- printf "%s-%s-headless" (include "portkey.fullname" .) .Values.clickhouseKeeper.name -}}
+{{- end -}}
+
+{{- define "clickhouseKeeper.serviceAccountName" -}}
+{{- if .Values.clickhouseKeeper.serviceAccount.create -}}
+ {{ default (printf "%s-%s" (include "portkey.fullname" .) .Values.clickhouseKeeper.name) .Values.clickhouseKeeper.serviceAccount.name | trunc 63 | trimSuffix "-" }}
+{{- else -}}
+ {{ default "default" .Values.clickhouseKeeper.serviceAccount.name }}
+{{- end -}}
+{{- end -}}
+
{{- define "mysql.serviceAccountName" -}}
{{- if .Values.mysql.serviceAccount.create -}}
{{ default (printf "%s-%s" (include "portkey.fullname" .) .Values.mysql.name) .Values.mysql.serviceAccount.name | trunc 63 | trimSuffix "-" }}
diff --git a/charts/portkey-app/templates/backend/deployment.yaml b/charts/portkey-app/templates/backend/deployment.yaml
index 53473c4..8741a4f 100644
--- a/charts/portkey-app/templates/backend/deployment.yaml
+++ b/charts/portkey-app/templates/backend/deployment.yaml
@@ -100,6 +100,16 @@ spec:
- name: MCP_GATEWAY_URL
value: {{ .Values.mcp.externalUrl | quote }}
{{- end }}
+ {{- if include "clickhouse.replicationEnabled" . }}
+ - name: CLICKHOUSE_REPLICATED
+ value: "true"
+ - name: CLICKHOUSE_CLUSTER_NAME
+ value: {{ .Values.clickhouse.clusterName | quote }}
+ {{- end }}
+ {{- if include "clickhouse.shardingEnabled" . }}
+ - name: CLICKHOUSE_SHARDING_ENABLED
+ value: "true"
+ {{- end }}
image: "{{ .Values.images.backendImage.repository }}:{{ .Values.images.backendImage.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.images.backendImage.pullPolicy }}
command: ["/bin/sh", "-c"]
diff --git a/charts/portkey-app/templates/clickhouse-keeper/config-map.yaml b/charts/portkey-app/templates/clickhouse-keeper/config-map.yaml
new file mode 100644
index 0000000..8debbd7
--- /dev/null
+++ b/charts/portkey-app/templates/clickhouse-keeper/config-map.yaml
@@ -0,0 +1,43 @@
+{{- if include "clickhouseKeeper.deployEnabled" . }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ include "portkey.fullname" . }}-{{ .Values.clickhouseKeeper.name }}
+ labels:
+ {{- include "portkey.labels" . | nindent 4 }}
+ annotations:
+ {{- include "portkey.annotations" . | nindent 4 }}
+data:
+ keeper_config.xml: |
+
+
+ information
+ 1
+
+
+ {{ .Values.clickhouseKeeper.containerPort }}
+ ${SERVER_ID}
+ /var/lib/clickhouse-keeper/log
+ /var/lib/clickhouse-keeper/snapshots
+
+ 10000
+ 30000
+ warning
+
+
+ {{- $keeperReplicas := int .Values.clickhouseKeeper.replicas }}
+ {{- $fullname := include "portkey.fullname" . }}
+ {{- $keeperName := .Values.clickhouseKeeper.name }}
+ {{- $headlessSvc := include "clickhouseKeeper.headlessServiceName" . }}
+ {{- $raftPort := .Values.clickhouseKeeper.containerRaftPort }}
+ {{- range $i := until $keeperReplicas }}
+
+ {{ add $i 1 }}
+ {{ $fullname }}-{{ $keeperName }}-{{ $i }}.{{ $headlessSvc }}
+ {{ $raftPort }}
+
+ {{- end }}
+
+
+
+{{- end }}
diff --git a/charts/portkey-app/templates/clickhouse-keeper/headless-service.yaml b/charts/portkey-app/templates/clickhouse-keeper/headless-service.yaml
new file mode 100644
index 0000000..12ca86e
--- /dev/null
+++ b/charts/portkey-app/templates/clickhouse-keeper/headless-service.yaml
@@ -0,0 +1,32 @@
+{{- if include "clickhouseKeeper.deployEnabled" . }}
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "clickhouseKeeper.headlessServiceName" . }}
+ labels:
+ {{- include "portkey.labels" . | nindent 4 }}
+ {{- with .Values.clickhouseKeeper.service.labels }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+ annotations:
+ {{- include "portkey.annotations" . | nindent 4 }}
+ {{- with .Values.clickhouseKeeper.service.annotations }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ type: ClusterIP
+ clusterIP: None
+ publishNotReadyAddresses: true
+ ports:
+ - name: keeper-client
+ port: {{ .Values.clickhouseKeeper.containerPort }}
+ targetPort: keeper-client
+ protocol: TCP
+ - name: keeper-raft
+ port: {{ .Values.clickhouseKeeper.containerRaftPort }}
+ targetPort: keeper-raft
+ protocol: TCP
+ selector:
+ {{- include "portkey.selectorLabels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ include "portkey.fullname" . }}-{{ .Values.clickhouseKeeper.name }}
+{{- end }}
diff --git a/charts/portkey-app/templates/clickhouse-keeper/service-account.yaml b/charts/portkey-app/templates/clickhouse-keeper/service-account.yaml
new file mode 100644
index 0000000..3b79829
--- /dev/null
+++ b/charts/portkey-app/templates/clickhouse-keeper/service-account.yaml
@@ -0,0 +1,16 @@
+{{- if and (include "clickhouseKeeper.deployEnabled" .) .Values.clickhouseKeeper.serviceAccount.create -}}
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: {{ include "clickhouseKeeper.serviceAccountName" . }}
+ labels:
+ {{- include "portkey.labels" . | nindent 4 }}
+ {{- with .Values.clickhouseKeeper.serviceAccount.labels }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+ annotations:
+ {{- include "portkey.annotations" . | nindent 4 }}
+ {{- with .Values.clickhouseKeeper.serviceAccount.annotations }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+{{- end }}
diff --git a/charts/portkey-app/templates/clickhouse-keeper/stateful-set.yaml b/charts/portkey-app/templates/clickhouse-keeper/stateful-set.yaml
new file mode 100644
index 0000000..edf1ab2
--- /dev/null
+++ b/charts/portkey-app/templates/clickhouse-keeper/stateful-set.yaml
@@ -0,0 +1,140 @@
+{{- if include "clickhouseKeeper.deployEnabled" . }}
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+ name: {{ include "portkey.fullname" . }}-{{ .Values.clickhouseKeeper.name }}
+ labels:
+ {{- include "portkey.labels" . | nindent 4 }}
+ {{- with .Values.clickhouseKeeper.statefulSet.labels }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+ annotations:
+ {{- include "portkey.annotations" . | nindent 4 }}
+ {{- with .Values.clickhouseKeeper.statefulSet.annotations }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ serviceName: {{ include "clickhouseKeeper.headlessServiceName" . }}
+ replicas: {{ .Values.clickhouseKeeper.replicas }}
+ selector:
+ matchLabels:
+ {{- include "portkey.selectorLabels" . | nindent 6 }}
+ app.kubernetes.io/component: {{ include "portkey.fullname" . }}-{{ .Values.clickhouseKeeper.name }}
+ template:
+ metadata:
+ {{- with .Values.clickhouseKeeper.statefulSet.annotations }}
+ annotations:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ labels:
+ {{- with .Values.clickhouseKeeper.statefulSet.labels }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- include "portkey.labels" . | nindent 8 }}
+ app.kubernetes.io/component: {{ include "portkey.fullname" . }}-{{ .Values.clickhouseKeeper.name }}
+ spec:
+ imagePullSecrets:
+ {{- range .Values.imageCredentials }}
+ - name: {{ .name }}
+ {{- end }}
+ securityContext:
+ {{- toYaml .Values.clickhouseKeeper.statefulSet.podSecurityContext | nindent 8 }}
+ serviceAccountName: {{ include "clickhouseKeeper.serviceAccountName" . }}
+ initContainers:
+ - name: generate-keeper-config
+ image: busybox:1.36
+ command:
+ - sh
+ - -c
+ - |
+ HOSTNAME=$(hostname)
+ SERVER_ID=$((${HOSTNAME##*-} + 1))
+ sed "s/\${SERVER_ID}/${SERVER_ID}/g" /etc/clickhouse-keeper-template/keeper_config.xml > /etc/clickhouse-keeper/keeper_config.xml
+ volumeMounts:
+ - name: keeper-config-template
+ mountPath: /etc/clickhouse-keeper-template
+ - name: keeper-config
+ mountPath: /etc/clickhouse-keeper
+ containers:
+ - name: {{ .Values.clickhouseKeeper.name }}
+ image: "{{ .Values.images.clickhouseImage.repository }}:{{ .Values.images.clickhouseImage.tag | default .Chart.AppVersion }}"
+ imagePullPolicy: {{ .Values.images.clickhouseImage.pullPolicy }}
+ command:
+ - clickhouse-keeper
+ - --config-file=/etc/clickhouse-keeper/keeper_config.xml
+ ports:
+ - name: keeper-client
+ containerPort: {{ .Values.clickhouseKeeper.containerPort }}
+ protocol: TCP
+ - name: keeper-raft
+ containerPort: {{ .Values.clickhouseKeeper.containerRaftPort }}
+ protocol: TCP
+ readinessProbe:
+ exec:
+ command:
+ - bash
+ - -c
+ - echo ruok | nc localhost {{ .Values.clickhouseKeeper.containerPort }} | grep -q imok
+ initialDelaySeconds: 10
+ periodSeconds: 10
+ timeoutSeconds: 5
+ livenessProbe:
+ exec:
+ command:
+ - bash
+ - -c
+ - echo ruok | nc localhost {{ .Values.clickhouseKeeper.containerPort }} | grep -q imok
+ initialDelaySeconds: 15
+ periodSeconds: 20
+ timeoutSeconds: 5
+ resources:
+ {{- toYaml .Values.clickhouseKeeper.statefulSet.resources | nindent 12 }}
+ securityContext:
+ {{- toYaml .Values.clickhouseKeeper.statefulSet.securityContext | nindent 12 }}
+ volumeMounts:
+ - name: keeper-config
+ mountPath: /etc/clickhouse-keeper
+ - name: keeper-data
+ mountPath: /var/lib/clickhouse-keeper
+ {{- with .Values.clickhouseKeeper.statefulSet.nodeSelector }}
+ nodeSelector:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with .Values.clickhouseKeeper.statefulSet.affinity }}
+ affinity:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with .Values.clickhouseKeeper.statefulSet.tolerations }}
+ tolerations:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ volumes:
+ - name: keeper-config-template
+ configMap:
+ name: {{ include "portkey.fullname" . }}-{{ .Values.clickhouseKeeper.name }}
+ - name: keeper-config
+ emptyDir: {}
+ {{- if not .Values.clickhouseKeeper.statefulSet.persistence.enabled }}
+ - name: keeper-data
+ emptyDir: {}
+ {{- end }}
+ {{- if .Values.clickhouseKeeper.statefulSet.persistence.enabled }}
+ volumeClaimTemplates:
+ - apiVersion: v1
+ kind: PersistentVolumeClaim
+ metadata:
+ name: keeper-data
+ labels:
+ {{- include "portkey.selectorLabels" . | nindent 10 }}
+ app.kubernetes.io/component: {{ include "portkey.fullname" . }}-{{ .Values.clickhouseKeeper.name }}
+ spec:
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: {{ .Values.clickhouseKeeper.statefulSet.persistence.size }}
+ {{- if .Values.clickhouseKeeper.statefulSet.persistence.storageClassName }}
+ storageClassName: {{ .Values.clickhouseKeeper.statefulSet.persistence.storageClassName }}
+ {{- end }}
+ {{- end }}
+{{- end }}
diff --git a/charts/portkey-app/templates/clickhouse/config-map.yaml b/charts/portkey-app/templates/clickhouse/config-map.yaml
index 15384ac..653c314 100644
--- a/charts/portkey-app/templates/clickhouse/config-map.yaml
+++ b/charts/portkey-app/templates/clickhouse/config-map.yaml
@@ -34,6 +34,62 @@ data:
{{ .Values.clickhouse.retention.ttlOnlyDropParts }}
{{- end }}
+ {{- if include "clickhouse.replicationEnabled" . }}
+ {{ .Values.clickhouse.containerInterserverPort }}
+
+ <{{ .Values.clickhouse.clusterName }}>
+ {{- if include "clickhouse.shardingEnabled" . }}
+ {{- $shardsCount := int .Values.clickhouse.sharding.shardsCount }}
+ {{- $replicasPerShard := int .Values.clickhouse.sharding.replicasPerShard }}
+ {{- $fullname := include "portkey.fullname" . }}
+ {{- $chName := .Values.clickhouse.name }}
+ {{- $headlessSvc := include "clickhouse.headlessServiceName" . }}
+ {{- $nativePort := .Values.clickhouse.containerNativePort }}
+ {{- range $s := until $shardsCount }}
+
+ true
+ {{- range $r := until $replicasPerShard }}
+ {{- $ordinal := add (mul $s $replicasPerShard) $r }}
+
+ {{ $fullname }}-{{ $chName }}-{{ $ordinal }}.{{ $headlessSvc }}
+ {{ $nativePort }}
+
+ {{- end }}
+
+ {{- end }}
+ {{- else }}
+
+ true
+
+ /clickhouse/discovery/{{ .Values.clickhouse.clusterName }}
+
+
+ {{- end }}
+ {{ .Values.clickhouse.clusterName }}>
+
+
+ {{- if .Values.clickhouseKeeper.external.enabled }}
+ {{- range .Values.clickhouseKeeper.external.hosts }}
+
+ {{ .host }}
+ {{ .port }}
+
+ {{- end }}
+ {{- else }}
+ {{- $keeperReplicas := int .Values.clickhouseKeeper.replicas }}
+ {{- $keeperHeadlessSvc := include "clickhouseKeeper.headlessServiceName" . }}
+ {{- $keeperFullname := include "portkey.fullname" . }}
+ {{- $keeperName := .Values.clickhouseKeeper.name }}
+ {{- $keeperPort := .Values.clickhouseKeeper.containerPort }}
+ {{- range $i := until $keeperReplicas }}
+
+ {{ $keeperFullname }}-{{ $keeperName }}-{{ $i }}.{{ $keeperHeadlessSvc }}
+ {{ $keeperPort }}
+
+ {{- end }}
+ {{- end }}
+
+ {{- end }}
{{- if not .Values.clickhouse.external.existingSecretName }}
users.xml: |
diff --git a/charts/portkey-app/templates/clickhouse/headless-service.yaml b/charts/portkey-app/templates/clickhouse/headless-service.yaml
new file mode 100644
index 0000000..4ddb057
--- /dev/null
+++ b/charts/portkey-app/templates/clickhouse/headless-service.yaml
@@ -0,0 +1,36 @@
+{{- if include "clickhouse.replicationEnabled" . }}
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "clickhouse.headlessServiceName" . }}
+ labels:
+ {{- include "portkey.labels" . | nindent 4 }}
+ {{- with .Values.clickhouse.service.labels }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+ annotations:
+ {{- include "portkey.annotations" . | nindent 4 }}
+ {{- with .Values.clickhouse.service.annotations }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ type: ClusterIP
+ clusterIP: None
+ publishNotReadyAddresses: true
+ ports:
+ - name: ch
+ port: {{ .Values.clickhouse.service.httpPort }}
+ targetPort: ch
+ protocol: TCP
+ - name: ch-native
+ port: {{ .Values.clickhouse.service.nativePort }}
+ targetPort: ch-native
+ protocol: TCP
+ - name: ch-interserver
+ port: {{ .Values.clickhouse.containerInterserverPort }}
+ targetPort: ch-interserver
+ protocol: TCP
+ selector:
+ {{- include "portkey.selectorLabels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ include "portkey.fullname" . }}-{{ .Values.clickhouse.name }}
+{{- end }}
diff --git a/charts/portkey-app/templates/clickhouse/service.yaml b/charts/portkey-app/templates/clickhouse/service.yaml
index 89cc3e3..d288764 100644
--- a/charts/portkey-app/templates/clickhouse/service.yaml
+++ b/charts/portkey-app/templates/clickhouse/service.yaml
@@ -29,6 +29,12 @@ spec:
port: {{ .Values.clickhouse.service.nativePort }}
targetPort: ch-native
protocol: TCP
+ {{- if include "clickhouse.replicationEnabled" . }}
+ - name: ch-interserver
+ port: {{ .Values.clickhouse.containerInterserverPort }}
+ targetPort: ch-interserver
+ protocol: TCP
+ {{- end }}
selector:
{{- include "portkey.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: {{ include "portkey.fullname" . }}-{{ .Values.clickhouse.name }}
diff --git a/charts/portkey-app/templates/clickhouse/stateful-set.yaml b/charts/portkey-app/templates/clickhouse/stateful-set.yaml
index d9b5644..09b50b3 100644
--- a/charts/portkey-app/templates/clickhouse/stateful-set.yaml
+++ b/charts/portkey-app/templates/clickhouse/stateful-set.yaml
@@ -14,17 +14,26 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
- serviceName: {{ include "portkey.fullname" . }}-{{ .Values.clickhouse.name }}
+ serviceName: {{ include "portkey.fullname" . }}-{{ .Values.clickhouse.name }}{{- if include "clickhouse.replicationEnabled" . }}-headless{{- end }}
+ {{- if include "clickhouse.shardingEnabled" . }}
+ replicas: {{ mul (int .Values.clickhouse.sharding.shardsCount) (int .Values.clickhouse.sharding.replicasPerShard) }}
+ {{- else }}
replicas: {{ .Values.clickhouse.statefulSet.replicas | default 1 }}
+ {{- end }}
selector:
matchLabels:
{{- include "portkey.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: {{ include "portkey.fullname" . }}-{{ .Values.clickhouse.name }}
template:
metadata:
- {{- with .Values.clickhouse.statefulSet.annotations }}
+ {{- if or .Values.clickhouse.statefulSet.annotations (include "clickhouse.replicationEnabled" .) }}
annotations:
+ {{- if include "clickhouse.replicationEnabled" . }}
+ checksum/config: {{ include (print $.Template.BasePath "/clickhouse/config-map.yaml") . | sha256sum }}
+ {{- end }}
+ {{- with .Values.clickhouse.statefulSet.annotations }}
{{- toYaml . | nindent 8 }}
+ {{- end }}
{{- end }}
labels:
{{- with .Values.clickhouse.statefulSet.labels }}
@@ -40,8 +49,9 @@ spec:
securityContext:
{{- toYaml .Values.clickhouse.statefulSet.podSecurityContext | nindent 8 }}
serviceAccountName: {{ include "clickhouse.serviceAccountName" . }}
- {{- if .Values.clickhouse.external.existingSecretName }}
+ {{- if or .Values.clickhouse.external.existingSecretName (include "clickhouse.replicationEnabled" .) }}
initContainers:
+ {{- if .Values.clickhouse.external.existingSecretName }}
- name: generate-users-config
image: busybox:1.36
command:
@@ -84,6 +94,45 @@ spec:
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
+ {{- end }}
+ {{- if include "clickhouse.replicationEnabled" . }}
+ - name: generate-macros
+ image: busybox:1.36
+ command:
+ - sh
+ - -c
+ - |
+ REPLICA=$(hostname)
+ ORDINAL=${REPLICA##*-}
+ {{- if include "clickhouse.shardingEnabled" . }}
+ SHARD=$(printf "%02d" $(( (ORDINAL / REPLICAS_PER_SHARD) + 1 )))
+ {{- else }}
+ SHARD="01"
+ {{- end }}
+ cat > /tmp/macros/macros.xml << EOF
+
+
+ ${CLUSTER_NAME}
+ ${SHARD}
+ ${REPLICA}
+
+
+ EOF
+ env:
+ - name: CLUSTER_NAME
+ value: {{ .Values.clickhouse.clusterName | quote }}
+ {{- if include "clickhouse.shardingEnabled" . }}
+ - name: REPLICAS_PER_SHARD
+ value: {{ .Values.clickhouse.sharding.replicasPerShard | quote }}
+ {{- end }}
+ volumeMounts:
+ - name: clickhouse-macros
+ mountPath: /tmp/macros
+ {{- with .Values.clickhouse.initContainer.resources }}
+ resources:
+ {{- toYaml . | nindent 12 }}
+ {{- end }}
+ {{- end }}
{{- end }}
containers:
- name: {{ .Values.clickhouse.name }}
@@ -122,6 +171,11 @@ spec:
- name: ch-native
containerPort: {{ .Values.clickhouse.containerNativePort }}
protocol: TCP
+ {{- if include "clickhouse.replicationEnabled" . }}
+ - name: ch-interserver
+ containerPort: {{ .Values.clickhouse.containerInterserverPort }}
+ protocol: TCP
+ {{- end }}
{{- with .Values.clickhouse.statefulSet.startupProbe }}
startupProbe:
{{- toYaml . | nindent 12 }}
@@ -152,11 +206,16 @@ spec:
name: clickhouse-conf
subPath: users.xml
{{- end }}
- {{- if .Values.clickhouse.customConfig.enabled }}
+ {{- if or .Values.clickhouse.customConfig.enabled (include "clickhouse.replicationEnabled" .) }}
- mountPath: /etc/clickhouse-server/config.d/config.xml
name: clickhouse-conf
subPath: config.xml
{{- end }}
+ {{- if include "clickhouse.replicationEnabled" . }}
+ - mountPath: /etc/clickhouse-server/config.d/macros.xml
+ name: clickhouse-macros
+ subPath: macros.xml
+ {{- end }}
{{- with .Values.clickhouse.statefulSet.extraContainerConfig }}
{{- toYaml . | nindent 10 }}
{{- end }}
@@ -183,7 +242,7 @@ spec:
{{- if .Values.clickhouse.external.existingSecretName }}
- name: clickhouse-users-config
emptyDir: {}
- {{- if .Values.clickhouse.customConfig.enabled }}
+ {{- if or .Values.clickhouse.customConfig.enabled (include "clickhouse.replicationEnabled" .) }}
- name: clickhouse-conf
configMap:
name: {{ include "portkey.fullname" . }}-{{ .Values.clickhouse.name }}
@@ -198,11 +257,15 @@ spec:
items:
- key: users.xml
path: users.xml
- {{- if .Values.clickhouse.customConfig.enabled }}
+ {{- if or .Values.clickhouse.customConfig.enabled (include "clickhouse.replicationEnabled" .) }}
- key: config.xml
path: config.xml
{{- end }}
{{- end }}
+ {{- if include "clickhouse.replicationEnabled" . }}
+ - name: clickhouse-macros
+ emptyDir: {}
+ {{- end }}
{{- with .Values.clickhouse.statefulSet.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
diff --git a/charts/portkey-app/values.yaml b/charts/portkey-app/values.yaml
index f0806bd..2f7a255 100644
--- a/charts/portkey-app/values.yaml
+++ b/charts/portkey-app/values.yaml
@@ -684,6 +684,12 @@ clickhouse:
verificationMode: "strict"
containerHttpPort: 8123
containerNativePort: 9000
+ containerInterserverPort: 9009
+ clusterName: "portkey_cluster"
+ sharding:
+ enabled: false
+ shardsCount: 1
+ replicasPerShard: 1
initContainer:
resources: {}
# resources:
@@ -760,6 +766,39 @@ clickhouse:
labels: {}
annotations: {}
+clickhouseKeeper:
+ enabled: false
+ name: "clickhouse-keeper"
+ replicas: 3
+ containerPort: 2181
+ containerRaftPort: 9234
+ external:
+ enabled: false
+ hosts: []
+ # - host: keeper-1.example.com
+ # port: 2181
+ statefulSet:
+ labels: {}
+ annotations: {}
+ podSecurityContext: {}
+ securityContext: {}
+ resources: {}
+ nodeSelector: {}
+ tolerations: []
+ affinity: {}
+ persistence:
+ enabled: false
+ size: 5Gi
+ storageClassName: ""
+ service:
+ labels: {}
+ annotations: {}
+ serviceAccount:
+ create: true
+ name: ""
+ labels: {}
+ annotations: {}
+
apm:
grafana:
enabled: false