From 9db0cccaca47c8ea08cc61bba12c3c0b4c814a72 Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Sat, 8 Jun 2024 08:52:06 +0300 Subject: [PATCH] Make zookeeper healthchecks compatible with Alpine's busybox nc (#504) * Make zookeeper healthchecks compatible with Alpine's busybox nc * Test Pulsar 3.3.0 image * Use 127.0.0.1 instead of localhost in zookeeper healthchecks - Alpine nc fails if "localhost" is used. - perhaps it defaults to use IPv6? * Disable testing with Pulsar 3.3.0 image until 3.3.1 is released - the image needs "apk add bind-tools" since busybox nslookup isn't compatible with kubernetes --- .ci/clusters/values-pulsar-latest.yaml | 20 +++++++++++++++++++ .github/workflows/pulsar-helm-chart-ci.yaml | 7 +++++++ .../templates/zookeeper-statefulset.yaml | 10 +++++----- 3 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 .ci/clusters/values-pulsar-latest.yaml diff --git a/.ci/clusters/values-pulsar-latest.yaml b/.ci/clusters/values-pulsar-latest.yaml new file mode 100644 index 0000000..3b06517 --- /dev/null +++ b/.ci/clusters/values-pulsar-latest.yaml @@ -0,0 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +defaultPulsarImageTag: 3.3.0 \ No newline at end of file diff --git a/.github/workflows/pulsar-helm-chart-ci.yaml b/.github/workflows/pulsar-helm-chart-ci.yaml index 4e4f05e..3ed4760 100644 --- a/.github/workflows/pulsar-helm-chart-ci.yaml +++ b/.github/workflows/pulsar-helm-chart-ci.yaml @@ -209,6 +209,13 @@ jobs: values_file: .ci/clusters/values-pulsar-manager.yaml shortname: pulsar-manager include: + # - k8sVersion: + # version: "1.21.14" + # kind_image_tag: v1.21.14@sha256:8a4e9bb3f415d2bb81629ce33ef9c76ba514c14d707f9797a01e3216376ba093 + # testScenario: + # name: "Pulsar Latest" + # values_file: .ci/clusters/values-pulsar-latest.yaml + # shortname: pulsar-latest - k8sVersion: version: "1.21.14" kind_image_tag: v1.21.14@sha256:8a4e9bb3f415d2bb81629ce33ef9c76ba514c14d707f9797a01e3216376ba093 diff --git a/charts/pulsar/templates/zookeeper-statefulset.yaml b/charts/pulsar/templates/zookeeper-statefulset.yaml index 5a7ea79..8f0ef6e 100755 --- a/charts/pulsar/templates/zookeeper-statefulset.yaml +++ b/charts/pulsar/templates/zookeeper-statefulset.yaml @@ -156,9 +156,9 @@ spec: 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" -}} + {{- $zkConnectCommand = print "openssl s_client -quiet -crlf -connect 127.0.0.1:" .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 -}} + {{- $zkConnectCommand = print "nc 127.0.0.1 " .Values.zookeeper.ports.client -}} {{- end }} {{- if .Values.zookeeper.probe.readiness.enabled }} {{- if and (semverCompare "<1.25-0" .Capabilities.KubeVersion.Version) .Values.rbac.enabled .Values.rbac.psp }} @@ -172,7 +172,7 @@ spec: - "{{ .Values.zookeeper.probe.readiness.timeoutSeconds }}" - bash - -c - - 'echo ruok | {{ $zkConnectCommand }} | grep imok' + - '{ echo ruok; sleep 1; } | {{ $zkConnectCommand }} | grep imok' initialDelaySeconds: {{ .Values.zookeeper.probe.readiness.initialDelaySeconds }} periodSeconds: {{ .Values.zookeeper.probe.readiness.periodSeconds }} timeoutSeconds: {{ .Values.zookeeper.probe.readiness.timeoutSeconds }} @@ -186,7 +186,7 @@ spec: - "{{ .Values.zookeeper.probe.liveness.timeoutSeconds }}" - bash - -c - - 'echo ruok | {{ $zkConnectCommand }} | grep imok' + - '{ echo ruok; sleep 1; } | {{ $zkConnectCommand }} | grep imok' initialDelaySeconds: {{ .Values.zookeeper.probe.liveness.initialDelaySeconds }} periodSeconds: {{ .Values.zookeeper.probe.liveness.periodSeconds }} timeoutSeconds: {{ .Values.zookeeper.probe.liveness.timeoutSeconds }} @@ -200,7 +200,7 @@ spec: - "{{ .Values.zookeeper.probe.startup.timeoutSeconds }}" - bash - -c - - 'echo ruok | {{ $zkConnectCommand }} | grep imok' + - '{ echo ruok; sleep 1; } | {{ $zkConnectCommand }} | grep imok' initialDelaySeconds: {{ .Values.zookeeper.probe.startup.initialDelaySeconds }} periodSeconds: {{ .Values.zookeeper.probe.startup.periodSeconds }} timeoutSeconds: {{ .Values.zookeeper.probe.startup.timeoutSeconds }}