Skip to content

Commit

Permalink
fix: configuring kafka to use zookeeper uses only brokers, and servic…
Browse files Browse the repository at this point in the history
…e name in db-check is wrong (#1494)

Co-authored-by: Damien <[email protected]>
  • Loading branch information
maitredede and maitredede authored Sep 30, 2024
1 parent 1782966 commit 34d4975
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions charts/sentry/templates/hooks/sentry-db-check.job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,28 +113,30 @@ spec:
while [ $KAFKA_STATUS -eq 0 ]; do
KAFKA_STATUS=1
{{- if .Values.kafka.enabled }}
KAFKA_REPLICAS={{ .Values.kafka.controller.replicaCount | default 3 }}
{{- if .Values.kafka.zookeeper.enabled }}
echo "Kafka Zookeeper is enabled, checking if Zookeeper is up"
ZOOKEEPER_STATUS=0
while [ $ZOOKEEPER_STATUS -eq 0 ]; do
ZOOKEEPER_STATUS=1
KAFKA_REPLICAS={{ .Values.kafka.broker.replicaCount | default 3 }}
echo "Kafka Zookeeper is enabled, checking if kafka brokers are up"
KZ_STATUS=0
while [ $KZ_STATUS -eq 0 ]; do
KZ_STATUS=1
i=0; while [ $i -lt $KAFKA_REPLICAS ]; do
ZOOKEEPER_HOST={{ $kafkaHost }}-$i.{{ $kafkaHost }}-headless
if ! nc -z "$ZOOKEEPER_HOST" {{ .Values.kafka.zookeeper.port }}; then
ZOOKEEPER_STATUS=0
echo "$ZOOKEEPER_HOST is not available yet"
KZ_HOST={{ $kafkaHost }}-broker-$i.{{ $kafkaHost }}-broker-headless
if ! nc -z "$KZ_HOST" {{ $kafkaPort }}; then
KZ_STATUS=0
echo "$KZ_HOST is not available yet"
fi
i=$((i+1))
done
if [ "$ZOOKEEPER_STATUS" -eq 0 ]; then
echo "Zookeeper not ready. Sleeping for 10s before trying again"
if [ "$KZ_STATUS" -eq 0 ]; then
echo "Kafka not ready. Sleeping for 10s before trying again"
sleep 10;
fi
done
echo "Zookeeper is up"
{{- end }}
{{- if .Values.kafka.kraft.enabled }}
KAFKA_REPLICAS={{ .Values.kafka.controller.replicaCount | default 3 }}
echo "Kafka Kraft is enabled, checking if Kraft controllers are up"
KRAFT_STATUS=0
while [ $KRAFT_STATUS -eq 0 ]; do
Expand Down

0 comments on commit 34d4975

Please sign in to comment.