diff --git a/incubator/kafka/Chart.yaml b/incubator/kafka/Chart.yaml index 7c774da584..c803b6fa44 100755 --- a/incubator/kafka/Chart.yaml +++ b/incubator/kafka/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 description: Apache Kafka is publish-subscribe messaging rethought as a distributed commit log. name: kafka -version: 0.20.9 +version: 0.21.0 appVersion: 5.0.1 keywords: - kafka diff --git a/incubator/kafka/templates/configmap-config.yaml b/incubator/kafka/templates/configmap-config.yaml index 020c8b5559..a4bfd9bf9f 100644 --- a/incubator/kafka/templates/configmap-config.yaml +++ b/incubator/kafka/templates/configmap-config.yaml @@ -13,14 +13,35 @@ data: cd /usr/bin until kafka-configs --zookeeper {{ $zk }} --entity-type topics --describe || (( count++ >= 6 )) do - echo "Waiting for Zookeeper..." + echo "Waiting for ZooKeeper..." sleep 20 done - until nc -z {{ template "kafka.fullname" . }} 9092 || (( retries++ >= 6 )) + + # expected='0,1,2,3,...,n,' + # the trailing comma is significant + expected='{{ until (int .Values.replicas) | join "," | trim }},' + connected_brokers='' + until [[ "$connected_brokers" == "$expected" ]] do - echo "Waiting for Kafka..." + echo "Waiting for all Kafka brokers to be connected to ZooKeeper..." + connected_brokers=$(zookeeper-shell {{ $zk }} ls /brokers/ids | \ + # brokers formatted as: [ 0, 1, 2 ] + tail -1 | \ + # broker ids separated by newline + grep -o '[0-9]\+' | \ + # they may have connected in a random order + sort | \ + # trim the leading and trailing whitespace + sed 's/ *$//' | \ + # Replace newline with comma + # The result has a trailing comma + tr '\n' ',' + ) + echo "Currently available brokers: $connected_brokers" + echo "Expected brokers: $expected" sleep 20 done + echo "Applying runtime configuration using {{ .Values.image }}:{{ .Values.imageTag }}" {{- range $n, $topic := .Values.topics }} {{- if and $topic.partitions $topic.replicationFactor $topic.reassignPartitions }}