FrankYang0529 commented on code in PR #18387:
URL: https://github.com/apache/kafka/pull/18387#discussion_r1944480119


##########
core/src/main/scala/kafka/server/KafkaConfig.scala:
##########
@@ -560,7 +560,17 @@ class KafkaConfig private(doLog: Boolean, val props: 
util.Map[_, _])
     controllerListenerNames.flatMap { name =>
       controllerAdvertisedListeners
         .find(endpoint => 
endpoint.listenerName.equals(ListenerName.normalised(name)))
-        .orElse(controllerListenersValue.find(endpoint => 
endpoint.listenerName.equals(ListenerName.normalised(name))))
+        .orElse(
+          // If users don't define advertised.listeners, the advertised 
controller listeners inherit from listeners configuration
+          // which match listener names in controller.listener.names. Also, 
removing "0.0.0.0" host to avoid validation errors.
+          controllerListenersValue
+            .find(endpoint => 
endpoint.listenerName.equals(ListenerName.normalised(name)))
+            .map(endpoint => if (endpoint.host == "0.0.0.0") {
+              new EndPoint(null, endpoint.port, endpoint.listenerName, 
endpoint.securityProtocol)

Review Comment:
   Add related comments. Thanks for the suggestion.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to