Skip to content

Commit

Permalink
Don't default ADVERTISED_PORT if listeners are configured
Browse files Browse the repository at this point in the history
If configuring listeners (and/or advertised.listeners) to support a
configuration with both PLAINTEXT and SSL endpoints[1], you must not set either
of advertised.{host,port}, otherwise the broker will only create the PLAINTEXT
endpoint.

advertised.host won't be defaulted unless another env var is set, but without
this patch there was no way to prevent advertised.port from being defaulted when
not present.

[1]: http://docs.confluent.io/2.0.0/kafka/incremental-security-upgrade.html
  • Loading branch information
pbrisbin committed Dec 14, 2016
1 parent 6605457 commit 61feb07
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion start-kafka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
if [[ -z "$KAFKA_PORT" ]]; then
export KAFKA_PORT=9092
fi
if [[ -z "$KAFKA_ADVERTISED_PORT" ]]; then
if [[ -z "$KAFKA_ADVERTISED_PORT" && \
-z "$KAFKA_LISTENERS" && \
-z "$KAFKA_ADVERTISED_LISTENERS" ]]; then
export KAFKA_ADVERTISED_PORT=$(docker port `hostname` $KAFKA_PORT | sed -r "s/.*:(.*)/\1/g")
fi
if [[ -z "$KAFKA_BROKER_ID" ]]; then
Expand Down

0 comments on commit 61feb07

Please sign in to comment.