This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
     new d70d94f  Fix pulsar_metadata.metadataStoreAllowReadOnlyOperations with 
ZooKeeper (#653)
d70d94f is described below

commit d70d94fbe8e25ac57de24801384ac075595a100d
Author: Lari Hotari <[email protected]>
AuthorDate: Mon Feb 23 23:41:50 2026 +0200

    Fix pulsar_metadata.metadataStoreAllowReadOnlyOperations with ZooKeeper 
(#653)
    
    - passing -Dreadonlymode.enable=true was missing from ZooKeeper server 
command line
    - init containers for waiting ZK availability in broker / bookie startup 
were blocked by not enabling readonly mode on zookeeper-shell
      - pass "-r" on command line
    - note: bookkeeper server doesn't support configuring readonly ZK support
    - it's necessary to set 
pulsar_metadata.bookkeeper.usePulsarMetadataClientDriver to true to enable 
readonly mode for the bookkeeper client.
---
 charts/pulsar/templates/bookkeeper-cluster-initialize.yaml | 2 +-
 charts/pulsar/templates/broker-statefulset.yaml            | 8 ++++----
 charts/pulsar/templates/proxy-statefulset.yaml             | 6 +++---
 charts/pulsar/templates/pulsar-cluster-initialize.yaml     | 2 +-
 charts/pulsar/templates/zookeeper-statefulset.yaml         | 6 +++++-
 5 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml 
b/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml
index 3269cc6..9b946bb 100755
--- a/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml
+++ b/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml
@@ -71,7 +71,7 @@ spec:
           - |
             {{- if $zk:=.Values.pulsar_metadata.userProvidedZookeepers }}
             export PULSAR_MEM="-Xmx128M";
-            until timeout 15 bin/pulsar zookeeper-shell -server {{ $zk }} ls 
{{ or .Values.metadataPrefix "/" }}; do
+            until timeout 15 bin/pulsar zookeeper-shell -r -server {{ $zk }} 
ls {{ or .Values.metadataPrefix "/" }}; do
               echo "user provided zookeepers {{ $zk }} are unreachable... 
check in 3 seconds ..." && sleep 3;
             done;
             {{ else }}
diff --git a/charts/pulsar/templates/broker-statefulset.yaml 
b/charts/pulsar/templates/broker-statefulset.yaml
index 68afa2e..785fa72 100644
--- a/charts/pulsar/templates/broker-statefulset.yaml
+++ b/charts/pulsar/templates/broker-statefulset.yaml
@@ -155,10 +155,10 @@ spec:
             {{- include "pulsar.broker.zookeeper.tls.settings" . | nindent 12 
}}
             export PULSAR_MEM="-Xmx128M";
             {{- if .Values.pulsar_metadata.configurationStore }}
-            until timeout 15 bin/pulsar zookeeper-shell -server {{ template 
"pulsar.configurationStore.connect" . }} get {{ 
.Values.pulsar_metadata.configurationStoreMetadataPrefix }}/admin/clusters/{{ 
template "pulsar.cluster.name" . }}; do
+            until timeout 15 bin/pulsar zookeeper-shell -r -server {{ template 
"pulsar.configurationStore.connect" . }} get {{ 
.Values.pulsar_metadata.configurationStoreMetadataPrefix }}/admin/clusters/{{ 
template "pulsar.cluster.name" . }}; do
             {{- end }}
             {{- if not .Values.pulsar_metadata.configurationStore }}
-            until timeout 15 bin/pulsar zookeeper-shell -server {{ template 
"pulsar.zookeeper.connect" . }} get {{ .Values.metadataPrefix 
}}/admin/clusters/{{ template "pulsar.cluster.name" . }}; do
+            until timeout 15 bin/pulsar zookeeper-shell -r -server {{ template 
"pulsar.zookeeper.connect" . }} get {{ .Values.metadataPrefix 
}}/admin/clusters/{{ template "pulsar.cluster.name" . }}; do
             {{- end }}
               echo "pulsar cluster {{ template "pulsar.cluster.name" . }} 
isn't initialized yet ... check in 3 seconds ..." && sleep 3;
             done;
@@ -265,11 +265,11 @@ spec:
           echo "OK" > "${statusFilePath:-status}";
           {{- if .Values.components.zookeeper }}
           {{- include "pulsar.broker.zookeeper.tls.settings" . | nindent 10 }}
-          timeout 15 bin/pulsar zookeeper-shell -server {{ template 
"pulsar.zookeeper.connect" . }} get {{ template "pulsar.broker.znode" . }};
+          timeout 15 bin/pulsar zookeeper-shell -r -server {{ template 
"pulsar.zookeeper.connect" . }} get {{ template "pulsar.broker.znode" . }};
           while [ $? -eq 0 ]; do
             echo "broker {{ template "pulsar.broker.hostname" . }} znode still 
exists ... check in 10 seconds ...";
             sleep 10;
-            timeout 15 bin/pulsar zookeeper-shell -server {{ template 
"pulsar.zookeeper.connect" . }} get {{ template "pulsar.broker.znode" . }};
+            timeout 15 bin/pulsar zookeeper-shell -r -server {{ template 
"pulsar.zookeeper.connect" . }} get {{ template "pulsar.broker.znode" . }};
           done;
           {{- end }}
           cat conf/pulsar_env.sh;
diff --git a/charts/pulsar/templates/proxy-statefulset.yaml 
b/charts/pulsar/templates/proxy-statefulset.yaml
index 0d2a7ec..a08af20 100644
--- a/charts/pulsar/templates/proxy-statefulset.yaml
+++ b/charts/pulsar/templates/proxy-statefulset.yaml
@@ -136,15 +136,15 @@ spec:
           - |
             export PULSAR_MEM="-Xmx128M";
             {{- if $zk:=.Values.pulsar_metadata.userProvidedZookeepers }}
-            until timeout 15 bin/pulsar zookeeper-shell -server {{ $zk }} ls 
{{ or .Values.metadataPrefix "/" }}; do
+            until timeout 15 bin/pulsar zookeeper-shell -r -server {{ $zk }} 
ls {{ or .Values.metadataPrefix "/" }}; do
               echo "user provided zookeepers {{ $zk }} are unreachable... 
check in 3 seconds ..." && sleep 3;
             done; 
             {{- else if .Values.pulsar_metadata.configurationStore }}
-            until timeout 15 bin/pulsar zookeeper-shell -server {{ template 
"pulsar.configurationStore.service" . }} get {{ 
.Values.pulsar_metadata.configurationStoreMetadataPrefix }}/admin/clusters/{{ 
template "pulsar.cluster.name" . }}; do
+            until timeout 15 bin/pulsar zookeeper-shell -r -server {{ template 
"pulsar.configurationStore.service" . }} get {{ 
.Values.pulsar_metadata.configurationStoreMetadataPrefix }}/admin/clusters/{{ 
template "pulsar.cluster.name" . }}; do
               echo "pulsar cluster {{ template "pulsar.cluster.name" . }} 
isn't initialized yet ... check in 3 seconds ..." && sleep 3;
             done;
             {{- else }}
-            until timeout 15 bin/pulsar zookeeper-shell -server {{ template 
"pulsar.zookeeper.service" . }} get {{ .Values.metadataPrefix 
}}/admin/clusters/{{ template "pulsar.cluster.name" . }}; do
+            until timeout 15 bin/pulsar zookeeper-shell -r -server {{ template 
"pulsar.zookeeper.service" . }} get {{ .Values.metadataPrefix 
}}/admin/clusters/{{ template "pulsar.cluster.name" . }}; do
               echo "pulsar cluster {{ template "pulsar.cluster.name" . }} 
isn't initialized yet ... check in 3 seconds ..." && sleep 3;
             done;
             {{- end}}
diff --git a/charts/pulsar/templates/pulsar-cluster-initialize.yaml 
b/charts/pulsar/templates/pulsar-cluster-initialize.yaml
index 3099856..8da736f 100755
--- a/charts/pulsar/templates/pulsar-cluster-initialize.yaml
+++ b/charts/pulsar/templates/pulsar-cluster-initialize.yaml
@@ -79,7 +79,7 @@ spec:
           - |
             {{- if $zk := .Values.pulsar_metadata.userProvidedZookeepers }}
             export PULSAR_MEM="-Xmx128M";
-            until timeout 15 bin/pulsar zookeeper-shell -server {{ $zk }} ls 
{{ or .Values.metadataPrefix "/" }}; do
+            until timeout 15 bin/pulsar zookeeper-shell -r -server {{ $zk }} 
ls {{ or .Values.metadataPrefix "/" }}; do
               echo "user provided zookeepers {{ $zk }} are unreachable... 
check in 3 seconds ..." && sleep 3;
             done;
             {{ else if .Values.components.zookeeper }}
diff --git a/charts/pulsar/templates/zookeeper-statefulset.yaml 
b/charts/pulsar/templates/zookeeper-statefulset.yaml
index cf962be..53eff6f 100755
--- a/charts/pulsar/templates/zookeeper-statefulset.yaml
+++ b/charts/pulsar/templates/zookeeper-statefulset.yaml
@@ -152,7 +152,11 @@ spec:
           bin/apply-config-from-env.py conf/zookeeper.conf;
           {{- include "pulsar.zookeeper.tls.settings" . | nindent 10 }}
           bin/generate-zookeeper-config.sh conf/zookeeper.conf;
-          OPTS="${OPTS} -Dlog4j2.formatMsgNoLookups=true" exec bin/pulsar 
zookeeper;
+          {{- $readOnlyMode := false -}}
+          {{- if hasKey .Values.pulsar_metadata 
"metadataStoreAllowReadOnlyOperations" }}
+          {{- $readOnlyMode = not (not 
.Values.pulsar_metadata.metadataStoreAllowReadOnlyOperations) -}}
+          {{- end }}
+          OPTS="-Dreadonlymode.enabled={{ $readOnlyMode }} ${OPTS} 
-Dlog4j2.formatMsgNoLookups=true" exec bin/pulsar zookeeper;
         ports:
         # prometheus needs to access /metrics endpoint
         - name: http

Reply via email to