diff --git a/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml b/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml index c66f6f2..6de4202 100644 --- a/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml +++ b/charts/pulsar/templates/bookkeeper-cluster-initialize.yaml @@ -49,6 +49,7 @@ spec: args: - >- {{- if $zk:=.Values.pulsar_metadata.userProvidedZookeepers }} + export PULSAR_MEM="-Xmx128M"; until bin/pulsar zookeeper-shell -server {{ $zk }} ls {{ or .Values.metadataPrefix "/" }}; do echo "user provided zookeepers {{ $zk }} are unreachable... check in 3 seconds ..." && sleep 3; done; @@ -70,6 +71,7 @@ spec: - > bin/apply-config-from-env.py conf/bookkeeper.conf; {{- include "pulsar.toolset.zookeeper.tls.settings" . | nindent 12 }} + export BOOKIE_MEM="-Xmx128M"; if bin/bookkeeper shell whatisinstanceid; then echo "bookkeeper cluster already initialized"; else diff --git a/charts/pulsar/templates/broker-statefulset.yaml b/charts/pulsar/templates/broker-statefulset.yaml index ddbc9a2..199cc8c 100644 --- a/charts/pulsar/templates/broker-statefulset.yaml +++ b/charts/pulsar/templates/broker-statefulset.yaml @@ -114,6 +114,7 @@ spec: args: - >- {{- include "pulsar.broker.zookeeper.tls.settings" . | nindent 12 }} + export BOOKIE_MEM="-Xmx128M"; {{- if .Values.pulsar_metadata.configurationStore }} until bin/bookkeeper org.apache.zookeeper.ZooKeeperMain -server {{ template "pulsar.configurationStore.connect" . }} get {{ .Values.configurationStoreMetadataPrefix }}/admin/clusters/{{ template "pulsar.cluster.name" . }}; do {{- end }} @@ -138,6 +139,7 @@ spec: - > {{- include "pulsar.broker.zookeeper.tls.settings" . | nindent 12 }} bin/apply-config-from-env.py conf/bookkeeper.conf; + export BOOKIE_MEM="-Xmx128M"; until bin/bookkeeper shell whatisinstanceid; do echo "bookkeeper cluster is not initialized yet. backoff for 3 seconds ..."; sleep 3; diff --git a/charts/pulsar/templates/proxy-statefulset.yaml b/charts/pulsar/templates/proxy-statefulset.yaml index ccbb21d..e162134 100644 --- a/charts/pulsar/templates/proxy-statefulset.yaml +++ b/charts/pulsar/templates/proxy-statefulset.yaml @@ -115,6 +115,7 @@ spec: command: ["sh", "-c"] args: - >- + export PULSAR_MEM="-Xmx128M"; {{- if $zk:=.Values.pulsar_metadata.userProvidedZookeepers }} until bin/pulsar zookeeper-shell -server {{ $zk }} ls {{ or .Values.metadataPrefix "/" }}; do echo "user provided zookeepers {{ $zk }} are unreachable... check in 3 seconds ..." && sleep 3; diff --git a/charts/pulsar/templates/pulsar-cluster-initialize.yaml b/charts/pulsar/templates/pulsar-cluster-initialize.yaml index 0c71824..40fa032 100644 --- a/charts/pulsar/templates/pulsar-cluster-initialize.yaml +++ b/charts/pulsar/templates/pulsar-cluster-initialize.yaml @@ -58,6 +58,7 @@ spec: args: - >- {{- if $zk:=.Values.pulsar_metadata.userProvidedZookeepers }} + export PULSAR_MEM="-Xmx128M"; until bin/pulsar zookeeper-shell -server {{ $zk }} ls {{ or .Values.metadataPrefix "/" }}; do echo "user provided zookeepers {{ $zk }} are unreachable... check in 3 seconds ..." && sleep 3; done; @@ -75,6 +76,9 @@ spec: args: - > bin/apply-config-from-env.py conf/bookkeeper.conf; + echo Default BOOKIE_MEM settings are set very high, which can cause the init container to fail.; + echo Setting the memory to a lower value to avoid OOM as operations below are not memory intensive.; + export BOOKIE_MEM="-Xmx128M"; {{- include "pulsar.toolset.zookeeper.tls.settings" . | nindent 10 }} until bin/bookkeeper shell whatisinstanceid; do sleep 3; @@ -96,6 +100,7 @@ spec: args: - | {{- include "pulsar.toolset.zookeeper.tls.settings" . | nindent 12 }} + export PULSAR_MEM="-Xmx128M"; bin/pulsar initialize-cluster-metadata \ --cluster {{ template "pulsar.cluster.name" . }} \ --zookeeper {{ template "pulsar.zookeeper.connect" . }}{{ .Values.metadataPrefix }} \