Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions addons/clickhouse/scripts/clickhouse-ping.sh
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
#!/bin/bash
set -euo pipefail

TLS_MOUNT_PATH="/etc/pki/tls"
READINESS_PROBE_TIMEOUT="${READINESS_PROBE_TIMEOUT:-3}"
HOST="127.0.0.1"
SCHEME="http"
PORT="${CLICKHOUSE_HTTP_PORT:-8123}"

curl_args=(
--silent
--show-error
--fail
--connect-timeout "${READINESS_PROBE_TIMEOUT}"
--max-time "${READINESS_PROBE_TIMEOUT}"
wget_args=(
--spider
-q
-T 3
--tries=1
)

if [[ "${TLS_ENABLED:-false}" == "true" ]]; then
SCHEME="https"
PORT="${CLICKHOUSE_HTTPS_PORT:-8443}"
if [[ -f "${TLS_MOUNT_PATH}/ca.pem" ]]; then
curl_args+=(--cacert "${TLS_MOUNT_PATH}/ca.pem")
fi
if [[ -f "${TLS_MOUNT_PATH}/cert.pem" && -f "${TLS_MOUNT_PATH}/key.pem" ]]; then
curl_args+=(--cert "${TLS_MOUNT_PATH}/cert.pem" --key "${TLS_MOUNT_PATH}/key.pem")
fi
wget_args+=(--no-check-certificate)
fi

endpoint="${SCHEME}://${HOST}:${PORT}/ping"

if ! curl "${curl_args[@]}" "${endpoint}" >/dev/null; then
if ! /shared-tools/wget "${wget_args[@]}" "${endpoint}"; then
echo "Readiness probe failed accessing ${endpoint}" >&2
exit 1
fi
17 changes: 17 additions & 0 deletions addons/clickhouse/templates/cmpd-ch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ spec:
fsGroup: 0
seccompProfile:
type: RuntimeDefault
initContainers:
- name: copy-tools
imagePullPolicy: {{ .Values.busyboxImage.pullPolicy }}
command:
- sh
- -c
- |
cp /bin/wget /shared-tools/wget
chmod +x /shared-tools/wget
volumeMounts:
- name: shared-tools
mountPath: /shared-tools
containers:
- name: clickhouse
imagePullPolicy: {{ default "IfNotPresent" .Values.image.pullPolicy }}
Expand Down Expand Up @@ -70,12 +82,17 @@ spec:
mountPath: /etc/clickhouse-client
- name: scripts
mountPath: /scripts
- name: shared-tools
mountPath: /shared-tools
env:
- name: CURRENT_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
volumes:
- name: shared-tools
emptyDir: {}
updateStrategy: BestEffortParallel
logConfigs:
{{- range $name, $pattern := .Values.logConfigs }}
Expand Down
2 changes: 1 addition & 1 deletion addons/clickhouse/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ backupImage:
registry: ""
repository: apecloud/clickhouse-backup-full
pullPolicy: IfNotPresent
tag: 2.6.14
tag: 2.6.14