Files
charts/bitnami/clickhouse/templates/scripts-configmap.yaml
yywing d7ab8d7790 [bitnami/clickhouse]: support clickhouse keeper (#13669)
* feat: clickhouse support clickhouse keeper

Signed-off-by: yywing <386542536@qq.com>

* feat: add comment

Signed-off-by: yywing <386542536@qq.com>

Signed-off-by: yywing <386542536@qq.com>
2022-12-12 10:46:50 +01:00

33 lines
1.3 KiB
YAML

apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-scripts" (include "common.names.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: clickhouse
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
setup.sh: |-
#!/bin/bash
# Execute entrypoint as usual after obtaining KEEPER_SERVER_ID
# check KEEPER_SERVER_ID in persistent volume via myid
# if not present, set based on POD hostname
if [[ -f "/bitnami/clickhouse/keeper/data/myid" ]]; then
export KEEPER_SERVER_ID="$(cat /bitnami/clickhouse/keeper/data/myid)"
else
HOSTNAME="$(hostname -s)"
if [[ $HOSTNAME =~ (.*)-([0-9]+)$ ]]; then
export KEEPER_SERVER_ID=${BASH_REMATCH[2]}
else
echo "Failed to get index from hostname $HOST"
exit 1
fi
fi
exec /opt/bitnami/scripts/clickhouse/entrypoint.sh /opt/bitnami/scripts/clickhouse/run.sh -- --listen_host=0.0.0.0