KAFKA-18945 Enhance the docs for Admin APIs (#19315)

Enhance the documentation for Admin#describeCluster and
Admin#describeConfigs to clarify their behavior when using
bootstrap.controllers and bootstrap.servers.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
Kuan-Po Tseng 2025-03-31 13:49:04 +08:00 committed by GitHub
parent 4a5ae144ea
commit c095faa578
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -345,6 +345,9 @@ public interface Admin extends AutoCloseable {
/**
* Get information about the nodes in the cluster.
* <p>
* To obtain broker cluster information, you must configure {@link AdminClientConfig#BOOTSTRAP_SERVERS_CONFIG}.
* To obtain controller cluster information, you must configure {@link AdminClientConfig#BOOTSTRAP_CONTROLLERS_CONFIG}.
*
* @param options The options to use when getting information about the cluster.
* @return The DescribeClusterResult.
@ -473,6 +476,9 @@ public interface Admin extends AutoCloseable {
* <li>{@link ConfigResource.Type#CLIENT_METRICS}: will return empty configs</li>
* </ul>
* <p>
* Note that you cannot describe broker configs or broker logger using {@link AdminClientConfig#BOOTSTRAP_CONTROLLERS_CONFIG},
* and you cannot describe controller configs or controller logger using {@link AdminClientConfig#BOOTSTRAP_SERVERS_CONFIG}.
* <p>
* This operation is supported by brokers with version 0.11.0.0 or higher.
*
* @param resources See relevant type {@link ConfigResource.Type}

View File

@ -51,8 +51,10 @@ public class DescribeClusterResult {
}
/**
* Returns a future which yields the current controller id.
* Note that this may yield null, if the controller ID is not yet known.
* Returns a future which yields the current controller node.
* <p>
* When using {@link AdminClientConfig#BOOTSTRAP_SERVERS_CONFIG}, the controller refer to a random broker.
* When using {@link AdminClientConfig#BOOTSTRAP_CONTROLLERS_CONFIG}, it refers to the current voter leader.
*/
public KafkaFuture<Node> controller() {
return controller;