From 1c4f745941fda76e8ec532bc734b8499fe442b25 Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Thu, 17 Feb 2022 07:48:20 +0200 Subject: [PATCH] Improve Zookeeper "ruok" probes: use TLS port when TLS is enabled, specify "-q 1" for nc (#223) - NOTICE: we are no more using "bin/pulsar-zookeeper-ruok.sh" from the apachepulsar/pulsar docker image. The probe script is part of the chart. * Pass "-q 1" to netcat (nc) to fix issue with Zookeeper ruok probe - see https://github.com/apache/pulsar/pull/14088 * Send ruok to TLS port when TLS is enabled * Bump chart version --- charts/pulsar/Chart.yaml | 2 +- .../templates/zookeeper-statefulset.yaml | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/charts/pulsar/Chart.yaml b/charts/pulsar/Chart.yaml index 6fdd15f..c34fa4f 100644 --- a/charts/pulsar/Chart.yaml +++ b/charts/pulsar/Chart.yaml @@ -21,7 +21,7 @@ apiVersion: v2 appVersion: "2.7.4" description: Apache Pulsar Helm chart for Kubernetes name: pulsar -version: 2.7.11 +version: 2.7.12 home: https://pulsar.apache.org sources: - https://github.com/apache/pulsar diff --git a/charts/pulsar/templates/zookeeper-statefulset.yaml b/charts/pulsar/templates/zookeeper-statefulset.yaml index 054b1aa..4313f7f 100644 --- a/charts/pulsar/templates/zookeeper-statefulset.yaml +++ b/charts/pulsar/templates/zookeeper-statefulset.yaml @@ -141,6 +141,12 @@ spec: envFrom: - configMapRef: name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}" + {{- $zkConnectCommand := "" -}} + {{- if and .Values.tls.enabled .Values.tls.zookeeper.enabled }} + {{- $zkConnectCommand = print "openssl s_client -quiet -crlf -connect localhost:" .Values.zookeeper.ports.clientTls " -cert /pulsar/certs/zookeeper/tls.crt -key /pulsar/certs/zookeeper/tls.key" -}} + {{- else -}} + {{- $zkConnectCommand = print "nc -q 1 localhost " .Values.zookeeper.ports.client -}} + {{- end }} {{- if .Values.zookeeper.probe.readiness.enabled }} {{- if and .Values.rbac.enabled .Values.rbac.psp }} securityContext: @@ -151,7 +157,9 @@ spec: command: - timeout - "{{ .Values.zookeeper.probe.readiness.timeoutSeconds }}" - - bin/pulsar-zookeeper-ruok.sh + - bash + - -c + - 'echo ruok | {{ $zkConnectCommand }} | grep imok' initialDelaySeconds: {{ .Values.zookeeper.probe.readiness.initialDelaySeconds }} periodSeconds: {{ .Values.zookeeper.probe.readiness.periodSeconds }} timeoutSeconds: {{ .Values.zookeeper.probe.readiness.timeoutSeconds }} @@ -163,7 +171,9 @@ spec: command: - timeout - "{{ .Values.zookeeper.probe.liveness.timeoutSeconds }}" - - bin/pulsar-zookeeper-ruok.sh + - bash + - -c + - 'echo ruok | {{ $zkConnectCommand }} | grep imok' initialDelaySeconds: {{ .Values.zookeeper.probe.liveness.initialDelaySeconds }} periodSeconds: {{ .Values.zookeeper.probe.liveness.periodSeconds }} timeoutSeconds: {{ .Values.zookeeper.probe.liveness.timeoutSeconds }} @@ -175,7 +185,9 @@ spec: command: - timeout - "{{ .Values.zookeeper.probe.startup.timeoutSeconds }}" - - bin/pulsar-zookeeper-ruok.sh + - bash + - -c + - 'echo ruok | {{ $zkConnectCommand }} | grep imok' initialDelaySeconds: {{ .Values.zookeeper.probe.startup.initialDelaySeconds }} periodSeconds: {{ .Values.zookeeper.probe.startup.periodSeconds }} timeoutSeconds: {{ .Values.zookeeper.probe.startup.timeoutSeconds }}