You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "nizhikov (via GitHub)" <gi...@apache.org> on 2023/12/26 09:09:01 UTC

[PR] KAFKA-14588 [WIP] ZK properties moved to ZkConfig [kafka]

nizhikov opened a new pull request, #15075:
URL: https://github.com/apache/kafka/pull/15075

   This PR move ZK related properties from scala `KafkaConfig` to java `ZkConfig`.
   Similar to `TopicConfig` and other classes.
   
   It's required, because `ConfigCommand` depends on `ZkConfig` and command itself will be moved to `tools` module.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #15075:
URL: https://github.com/apache/kafka/pull/15075#issuecomment-2022073236

   @nizhikov Could you please rebase it again? Sorry for late review :(


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #15075:
URL: https://github.com/apache/kafka/pull/15075#discussion_r1539504855


##########
checkstyle/import-control-server.xml:
##########
@@ -82,6 +82,9 @@
       <allow class="org.apache.kafka.server.authorizer.AuthorizableRequestContext" />
       <allow pkg="org.apache.kafka.server.telemetry" />
     </subpackage>
+    <subpackage name="config">
+      <allow class="org.apache.zookeeper.client.ZKClientConfig" />

Review Comment:
   Done.



##########
checkstyle/import-control-jmh-benchmarks.xml:
##########
@@ -58,4 +58,7 @@
 
     <subpackage name="cache">
     </subpackage>
+    <subpackage name="metadata">

Review Comment:
   Done.



##########
build.gradle:
##########
@@ -831,6 +831,17 @@ project(':server') {
     implementation libs.metrics
 
     implementation libs.slf4jApi
+    implementation(libs.zookeeper) {

Review Comment:
   Done.



-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #15075:
URL: https://github.com/apache/kafka/pull/15075#issuecomment-2022937094

   ```
   ./gradlew cleanTest :tools:test --tests GetOffsetShellTest.testTopicPatternArgWithPartitionsArg :trogdor:test --tests CoordinatorTest.testTaskRequestWithOldStartMsGetsUpdated :connect:mirror:test --tests MirrorConnectorsIntegrationExactlyOnceTest.testReplicateSourceDefault --tests MirrorConnectorsWithCustomForwardingAdminIntegrationTest.testReplicateSourceDefault :core:test --tests ReplicaManagerTest.testRemoteFetchExpiresPerSecMetric --tests LogDirFailureTest.testIOExceptionDuringCheckpoint :clients:test --tests KafkaAdminClientTest.testClientSideTimeoutAfterFailureToReceiveResponse
   ```
   failed tests can pass on my local, so I'm about to merge it


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #15075:
URL: https://github.com/apache/kafka/pull/15075#discussion_r1540643481


##########
server/src/main/java/org/apache/kafka/server/config/ZkConfig.java:
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.server.config;
+
+import org.apache.zookeeper.client.ZKClientConfig;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class ZkConfig {
+    /** ********* Zookeeper Configuration ***********/
+    public static final String ZK_CONNECT_PROP = "zookeeper.connect";
+    public static final String ZK_SESSION_TIMEOUT_MS_PROP = "zookeeper.session.timeout.ms";
+    public static final String ZK_CONNECTION_TIMEOUT_MS_PROP = "zookeeper.connection.timeout.ms";
+    public static final String ZK_ENABLE_SECURE_ACLS_PROP = "zookeeper.set.acl";
+    public static final String ZK_MAX_IN_FLIGHT_REQUESTS_PROP = "zookeeper.max.in.flight.requests";
+    public static final String ZK_SSL_CLIENT_ENABLE_PROP = "zookeeper.ssl.client.enable";
+    public static final String ZK_CLIENT_CNXN_SOCKET_PROP = "zookeeper.clientCnxnSocket";
+    public static final String ZK_SSL_KEY_STORE_LOCATION_PROP = "zookeeper.ssl.keystore.location";
+    public static final String ZK_SSL_KEY_STORE_PASSWORD_PROP = "zookeeper.ssl.keystore.password";
+    public static final String ZK_SSL_KEY_STORE_TYPE_PROP = "zookeeper.ssl.keystore.type";
+    public static final String ZK_SSL_TRUST_STORE_LOCATION_PROP = "zookeeper.ssl.truststore.location";
+    public static final String ZK_SSL_TRUST_STORE_PASSWORD_PROP = "zookeeper.ssl.truststore.password";
+    public static final String ZK_SSL_TRUST_STORE_TYPE_PROP = "zookeeper.ssl.truststore.type";
+    public static final String ZK_SSL_PROTOCOL_PROP = "zookeeper.ssl.protocol";
+    public static final String ZK_SSL_ENABLED_PROTOCOLS_PROP = "zookeeper.ssl.enabled.protocols";
+    public static final String ZK_SSL_CIPHER_SUITES_PROP = "zookeeper.ssl.cipher.suites";
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_PROP = "zookeeper.ssl.endpoint.identification.algorithm";
+    public static final String ZK_SSL_CRL_ENABLE_PROP = "zookeeper.ssl.crl.enable";
+    public static final String ZK_SSL_OCSP_ENABLE_PROP = "zookeeper.ssl.ocsp.enable";
+
+    // a map from the Kafka config to the corresponding ZooKeeper Java system property
+    public static final Map<String, String> ZK_SSL_CONFIG_TO_SYSTEM_PROPERTY_MAP;
+
+    public static final String ZK_CONNECT_DOC = "Specifies the ZooKeeper connection string in the form <code>hostname:port</code> where host and port are the " +
+            "host and port of a ZooKeeper server. To allow connecting through other ZooKeeper nodes when that ZooKeeper machine is " +
+            "down you can also specify multiple hosts in the form <code>hostname1:port1,hostname2:port2,hostname3:port3</code>.\n" +
+            "The server can also have a ZooKeeper chroot path as part of its ZooKeeper connection string which puts its data under some path in the global ZooKeeper namespace. " +
+            "For example to give a chroot path of <code>/chroot/path</code> you would give the connection string as <code>hostname1:port1,hostname2:port2,hostname3:port3/chroot/path</code>.";
+    public static final String ZK_SESSION_TIMEOUT_MS_DOC = "Zookeeper session timeout";
+    public static final String ZK_CONNECTION_TIMEOUT_MS_DOC = "The max time that the client waits to establish a connection to ZooKeeper. If not set, the value in " + ZK_SESSION_TIMEOUT_MS_PROP + " is used";
+    public static final String ZK_ENABLE_SECURE_ACLS_DOC = "Set client to use secure ACLs";
+    public static final String ZK_MAX_IN_FLIGHT_REQUESTS_DOC = "The maximum number of unacknowledged requests the client will send to ZooKeeper before blocking.";
+    public static final String ZK_SSL_CLIENT_ENABLE_DOC;
+    public static final String ZK_CLIENT_CNXN_SOCKET_DOC;
+    public static final String ZK_SSL_KEY_STORE_LOCATION_DOC;
+    public static final String ZK_SSL_KEY_STORE_PASSWORD_DOC;
+    public static final String ZK_SSL_KEY_STORE_TYPE_DOC;
+    public static final String ZK_SSL_TRUST_STORE_LOCATION_DOC;
+    public static final String ZK_SSL_TRUST_STORE_PASSWORD_DOC;
+    public static final String ZK_SSL_TRUST_STORE_TYPE_DOC;
+    public static final String ZK_SSL_PROTOCOL_DOC;
+    public static final String ZK_SSL_ENABLED_PROTOCOLS_DOC;
+    public static final String ZK_SSL_CIPHER_SUITES_DOC;
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_DOC;
+    public static final String ZK_SSL_CRL_ENABLE_DOC;
+    public static final String ZK_SSL_OCSP_ENABLE_DOC;
+
+    public static final int ZK_SESSION_TIMEOUT_MS = 18000;
+    public static final boolean ZK_ENABLE_SECURE_ACLS = false;
+    public static final int ZK_MAX_IN_FLIGHT_REQUESTS = 10;
+    public static final boolean ZK_SSL_CLIENT_ENABLE = false;
+    public static final String ZK_SSL_PROTOCOL = "TLSv1.2";
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM = "HTTPS";
+    public static final boolean ZK_SSL_CRL_ENABLE = false;
+    public static final boolean ZK_SSL_OCSP_ENABLE = false;
+
+    static {
+        Map<String, String> zkSslConfigToSystemPropertyMap = new HashMap<>();
+
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CLIENT_ENABLE_PROP, ZKClientConfig.SECURE_CLIENT);
+        zkSslConfigToSystemPropertyMap.put(ZK_CLIENT_CNXN_SOCKET_PROP, ZKClientConfig.ZOOKEEPER_CLIENT_CNXN_SOCKET);
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_KEY_STORE_LOCATION_PROP, "zookeeper.ssl.keyStore.location");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_KEY_STORE_PASSWORD_PROP, "zookeeper.ssl.keyStore.password");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_KEY_STORE_TYPE_PROP, "zookeeper.ssl.keyStore.type");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_TRUST_STORE_LOCATION_PROP, "zookeeper.ssl.trustStore.location");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_TRUST_STORE_PASSWORD_PROP, "zookeeper.ssl.trustStore.password");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_TRUST_STORE_TYPE_PROP, "zookeeper.ssl.trustStore.type");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_PROTOCOL_PROP, "zookeeper.ssl.protocol");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_ENABLED_PROTOCOLS_PROP, "zookeeper.ssl.enabledProtocols");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CIPHER_SUITES_PROP, "zookeeper.ssl.ciphersuites");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_PROP, "zookeeper.ssl.hostnameVerification");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CRL_ENABLE_PROP, "zookeeper.ssl.crl");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_OCSP_ENABLE_PROP, "zookeeper.ssl.ocsp");
+
+        ZK_SSL_CONFIG_TO_SYSTEM_PROPERTY_MAP = Collections.unmodifiableMap(zkSslConfigToSystemPropertyMap);
+
+        ZK_SSL_CLIENT_ENABLE_DOC = "Set client to use TLS when connecting to ZooKeeper." +

Review Comment:
   I reverted those changes and leave my first version.
   Because, java8 fails to load class if we use map values inside String constants definition.
   
   https://ci-builds.apache.org/blue/organizations/jenkins/Kafka%2Fkafka-pr/detail/PR-15075/16/pipeline/9 
   
   ```
   [2024-03-26T15:45:33.431Z] java.lang.StackOverflowError
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2296)
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2435)
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2435)
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2435)
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2435)
   [2024-03-26T15:45:33.431Z] 	at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
   ```



-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #15075:
URL: https://github.com/apache/kafka/pull/15075#discussion_r1539384087


##########
server/src/main/java/org/apache/kafka/server/config/ZkConfig.java:
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.server.config;
+
+import org.apache.zookeeper.client.ZKClientConfig;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class ZkConfig {
+    /** ********* Zookeeper Configuration ***********/
+    public static final String ZK_CONNECT_PROP = "zookeeper.connect";
+    public static final String ZK_SESSION_TIMEOUT_MS_PROP = "zookeeper.session.timeout.ms";
+    public static final String ZK_CONNECTION_TIMEOUT_MS_PROP = "zookeeper.connection.timeout.ms";
+    public static final String ZK_ENABLE_SECURE_ACLS_PROP = "zookeeper.set.acl";
+    public static final String ZK_MAX_IN_FLIGHT_REQUESTS_PROP = "zookeeper.max.in.flight.requests";
+    public static final String ZK_SSL_CLIENT_ENABLE_PROP = "zookeeper.ssl.client.enable";
+    public static final String ZK_CLIENT_CNXN_SOCKET_PROP = "zookeeper.clientCnxnSocket";
+    public static final String ZK_SSL_KEY_STORE_LOCATION_PROP = "zookeeper.ssl.keystore.location";
+    public static final String ZK_SSL_KEY_STORE_PASSWORD_PROP = "zookeeper.ssl.keystore.password";
+    public static final String ZK_SSL_KEY_STORE_TYPE_PROP = "zookeeper.ssl.keystore.type";
+    public static final String ZK_SSL_TRUST_STORE_LOCATION_PROP = "zookeeper.ssl.truststore.location";
+    public static final String ZK_SSL_TRUST_STORE_PASSWORD_PROP = "zookeeper.ssl.truststore.password";
+    public static final String ZK_SSL_TRUST_STORE_TYPE_PROP = "zookeeper.ssl.truststore.type";
+    public static final String ZK_SSL_PROTOCOL_PROP = "zookeeper.ssl.protocol";
+    public static final String ZK_SSL_ENABLED_PROTOCOLS_PROP = "zookeeper.ssl.enabled.protocols";
+    public static final String ZK_SSL_CIPHER_SUITES_PROP = "zookeeper.ssl.cipher.suites";
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_PROP = "zookeeper.ssl.endpoint.identification.algorithm";
+    public static final String ZK_SSL_CRL_ENABLE_PROP = "zookeeper.ssl.crl.enable";
+    public static final String ZK_SSL_OCSP_ENABLE_PROP = "zookeeper.ssl.ocsp.enable";
+
+    // a map from the Kafka config to the corresponding ZooKeeper Java system property
+    public static final Map<String, String> ZK_SSL_CONFIG_TO_SYSTEM_PROPERTY_MAP;
+
+    public static final String ZK_CONNECT_DOC = "Specifies the ZooKeeper connection string in the form <code>hostname:port</code> where host and port are the " +
+            "host and port of a ZooKeeper server. To allow connecting through other ZooKeeper nodes when that ZooKeeper machine is " +
+            "down you can also specify multiple hosts in the form <code>hostname1:port1,hostname2:port2,hostname3:port3</code>.\n" +
+            "The server can also have a ZooKeeper chroot path as part of its ZooKeeper connection string which puts its data under some path in the global ZooKeeper namespace. " +
+            "For example to give a chroot path of <code>/chroot/path</code> you would give the connection string as <code>hostname1:port1,hostname2:port2,hostname3:port3/chroot/path</code>.";
+    public static final String ZK_SESSION_TIMEOUT_MS_DOC = "Zookeeper session timeout";
+    public static final String ZK_CONNECTION_TIMEOUT_MS_DOC = "The max time that the client waits to establish a connection to ZooKeeper. If not set, the value in " + ZK_SESSION_TIMEOUT_MS_PROP + " is used";
+    public static final String ZK_ENABLE_SECURE_ACLS_DOC = "Set client to use secure ACLs";
+    public static final String ZK_MAX_IN_FLIGHT_REQUESTS_DOC = "The maximum number of unacknowledged requests the client will send to ZooKeeper before blocking.";
+    public static final String ZK_SSL_CLIENT_ENABLE_DOC;
+    public static final String ZK_CLIENT_CNXN_SOCKET_DOC;
+    public static final String ZK_SSL_KEY_STORE_LOCATION_DOC;
+    public static final String ZK_SSL_KEY_STORE_PASSWORD_DOC;
+    public static final String ZK_SSL_KEY_STORE_TYPE_DOC;
+    public static final String ZK_SSL_TRUST_STORE_LOCATION_DOC;
+    public static final String ZK_SSL_TRUST_STORE_PASSWORD_DOC;
+    public static final String ZK_SSL_TRUST_STORE_TYPE_DOC;
+    public static final String ZK_SSL_PROTOCOL_DOC;
+    public static final String ZK_SSL_ENABLED_PROTOCOLS_DOC;
+    public static final String ZK_SSL_CIPHER_SUITES_DOC;
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_DOC;
+    public static final String ZK_SSL_CRL_ENABLE_DOC;
+    public static final String ZK_SSL_OCSP_ENABLE_DOC;
+
+    public static final int ZK_SESSION_TIMEOUT_MS = 18000;
+    public static final boolean ZK_ENABLE_SECURE_ACLS = false;
+    public static final int ZK_MAX_IN_FLIGHT_REQUESTS = 10;
+    public static final boolean ZK_SSL_CLIENT_ENABLE = false;
+    public static final String ZK_SSL_PROTOCOL = "TLSv1.2";
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM = "HTTPS";
+    public static final boolean ZK_SSL_CRL_ENABLE = false;
+    public static final boolean ZK_SSL_OCSP_ENABLE = false;
+
+    static {
+        Map<String, String> zkSslConfigToSystemPropertyMap = new HashMap<>();
+
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CLIENT_ENABLE_PROP, ZKClientConfig.SECURE_CLIENT);

Review Comment:
   We can use constants to replace `ZKClientConfig.SECURE_CLIENT` and `ZKClientConfig.ZOOKEEPER_CLIENT_CNXN_SOCKET`, and then `server` module can get rid of zk dependency.



##########
checkstyle/import-control-server.xml:
##########
@@ -82,6 +82,9 @@
       <allow class="org.apache.kafka.server.authorizer.AuthorizableRequestContext" />
       <allow pkg="org.apache.kafka.server.telemetry" />
     </subpackage>
+    <subpackage name="config">
+      <allow class="org.apache.zookeeper.client.ZKClientConfig" />

Review Comment:
   ditto. we can remove it



##########
server/src/main/java/org/apache/kafka/server/config/ZkConfig.java:
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.server.config;
+
+import org.apache.zookeeper.client.ZKClientConfig;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class ZkConfig {
+    /** ********* Zookeeper Configuration ***********/
+    public static final String ZK_CONNECT_PROP = "zookeeper.connect";
+    public static final String ZK_SESSION_TIMEOUT_MS_PROP = "zookeeper.session.timeout.ms";
+    public static final String ZK_CONNECTION_TIMEOUT_MS_PROP = "zookeeper.connection.timeout.ms";
+    public static final String ZK_ENABLE_SECURE_ACLS_PROP = "zookeeper.set.acl";
+    public static final String ZK_MAX_IN_FLIGHT_REQUESTS_PROP = "zookeeper.max.in.flight.requests";
+    public static final String ZK_SSL_CLIENT_ENABLE_PROP = "zookeeper.ssl.client.enable";
+    public static final String ZK_CLIENT_CNXN_SOCKET_PROP = "zookeeper.clientCnxnSocket";
+    public static final String ZK_SSL_KEY_STORE_LOCATION_PROP = "zookeeper.ssl.keystore.location";
+    public static final String ZK_SSL_KEY_STORE_PASSWORD_PROP = "zookeeper.ssl.keystore.password";
+    public static final String ZK_SSL_KEY_STORE_TYPE_PROP = "zookeeper.ssl.keystore.type";
+    public static final String ZK_SSL_TRUST_STORE_LOCATION_PROP = "zookeeper.ssl.truststore.location";
+    public static final String ZK_SSL_TRUST_STORE_PASSWORD_PROP = "zookeeper.ssl.truststore.password";
+    public static final String ZK_SSL_TRUST_STORE_TYPE_PROP = "zookeeper.ssl.truststore.type";
+    public static final String ZK_SSL_PROTOCOL_PROP = "zookeeper.ssl.protocol";
+    public static final String ZK_SSL_ENABLED_PROTOCOLS_PROP = "zookeeper.ssl.enabled.protocols";
+    public static final String ZK_SSL_CIPHER_SUITES_PROP = "zookeeper.ssl.cipher.suites";
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_PROP = "zookeeper.ssl.endpoint.identification.algorithm";
+    public static final String ZK_SSL_CRL_ENABLE_PROP = "zookeeper.ssl.crl.enable";
+    public static final String ZK_SSL_OCSP_ENABLE_PROP = "zookeeper.ssl.ocsp.enable";
+
+    // a map from the Kafka config to the corresponding ZooKeeper Java system property
+    public static final Map<String, String> ZK_SSL_CONFIG_TO_SYSTEM_PROPERTY_MAP;
+
+    public static final String ZK_CONNECT_DOC = "Specifies the ZooKeeper connection string in the form <code>hostname:port</code> where host and port are the " +
+            "host and port of a ZooKeeper server. To allow connecting through other ZooKeeper nodes when that ZooKeeper machine is " +
+            "down you can also specify multiple hosts in the form <code>hostname1:port1,hostname2:port2,hostname3:port3</code>.\n" +
+            "The server can also have a ZooKeeper chroot path as part of its ZooKeeper connection string which puts its data under some path in the global ZooKeeper namespace. " +
+            "For example to give a chroot path of <code>/chroot/path</code> you would give the connection string as <code>hostname1:port1,hostname2:port2,hostname3:port3/chroot/path</code>.";
+    public static final String ZK_SESSION_TIMEOUT_MS_DOC = "Zookeeper session timeout";
+    public static final String ZK_CONNECTION_TIMEOUT_MS_DOC = "The max time that the client waits to establish a connection to ZooKeeper. If not set, the value in " + ZK_SESSION_TIMEOUT_MS_PROP + " is used";
+    public static final String ZK_ENABLE_SECURE_ACLS_DOC = "Set client to use secure ACLs";
+    public static final String ZK_MAX_IN_FLIGHT_REQUESTS_DOC = "The maximum number of unacknowledged requests the client will send to ZooKeeper before blocking.";
+    public static final String ZK_SSL_CLIENT_ENABLE_DOC;
+    public static final String ZK_CLIENT_CNXN_SOCKET_DOC;
+    public static final String ZK_SSL_KEY_STORE_LOCATION_DOC;
+    public static final String ZK_SSL_KEY_STORE_PASSWORD_DOC;
+    public static final String ZK_SSL_KEY_STORE_TYPE_DOC;
+    public static final String ZK_SSL_TRUST_STORE_LOCATION_DOC;
+    public static final String ZK_SSL_TRUST_STORE_PASSWORD_DOC;
+    public static final String ZK_SSL_TRUST_STORE_TYPE_DOC;
+    public static final String ZK_SSL_PROTOCOL_DOC;
+    public static final String ZK_SSL_ENABLED_PROTOCOLS_DOC;
+    public static final String ZK_SSL_CIPHER_SUITES_DOC;
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_DOC;
+    public static final String ZK_SSL_CRL_ENABLE_DOC;
+    public static final String ZK_SSL_OCSP_ENABLE_DOC;
+
+    public static final int ZK_SESSION_TIMEOUT_MS = 18000;
+    public static final boolean ZK_ENABLE_SECURE_ACLS = false;
+    public static final int ZK_MAX_IN_FLIGHT_REQUESTS = 10;
+    public static final boolean ZK_SSL_CLIENT_ENABLE = false;
+    public static final String ZK_SSL_PROTOCOL = "TLSv1.2";
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM = "HTTPS";
+    public static final boolean ZK_SSL_CRL_ENABLE = false;
+    public static final boolean ZK_SSL_OCSP_ENABLE = false;
+
+    static {
+        Map<String, String> zkSslConfigToSystemPropertyMap = new HashMap<>();
+
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CLIENT_ENABLE_PROP, ZKClientConfig.SECURE_CLIENT);
+        zkSslConfigToSystemPropertyMap.put(ZK_CLIENT_CNXN_SOCKET_PROP, ZKClientConfig.ZOOKEEPER_CLIENT_CNXN_SOCKET);
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_KEY_STORE_LOCATION_PROP, "zookeeper.ssl.keyStore.location");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_KEY_STORE_PASSWORD_PROP, "zookeeper.ssl.keyStore.password");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_KEY_STORE_TYPE_PROP, "zookeeper.ssl.keyStore.type");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_TRUST_STORE_LOCATION_PROP, "zookeeper.ssl.trustStore.location");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_TRUST_STORE_PASSWORD_PROP, "zookeeper.ssl.trustStore.password");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_TRUST_STORE_TYPE_PROP, "zookeeper.ssl.trustStore.type");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_PROTOCOL_PROP, "zookeeper.ssl.protocol");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_ENABLED_PROTOCOLS_PROP, "zookeeper.ssl.enabledProtocols");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CIPHER_SUITES_PROP, "zookeeper.ssl.ciphersuites");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_PROP, "zookeeper.ssl.hostnameVerification");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CRL_ENABLE_PROP, "zookeeper.ssl.crl");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_OCSP_ENABLE_PROP, "zookeeper.ssl.ocsp");
+
+        ZK_SSL_CONFIG_TO_SYSTEM_PROPERTY_MAP = Collections.unmodifiableMap(zkSslConfigToSystemPropertyMap);
+
+        ZK_SSL_CLIENT_ENABLE_DOC = "Set client to use TLS when connecting to ZooKeeper." +

Review Comment:
   it should be fine to initialize `ZK_SSL_CLIENT_ENABLE_DOC` when declaring it (line#60)



##########
checkstyle/import-control-jmh-benchmarks.xml:
##########
@@ -58,4 +58,7 @@
 
     <subpackage name="cache">
     </subpackage>
+    <subpackage name="metadata">

Review Comment:
   it seems be unnecessary



##########
build.gradle:
##########
@@ -831,6 +831,17 @@ project(':server') {
     implementation libs.metrics
 
     implementation libs.slf4jApi
+    implementation(libs.zookeeper) {

Review Comment:
   this can get removed (see my another comment)



##########
server/src/main/java/org/apache/kafka/server/config/ZkConfig.java:
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.server.config;
+
+import org.apache.zookeeper.client.ZKClientConfig;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class ZkConfig {

Review Comment:
   It seems we don't want to instantiate this class, so could you rename it to `ZkConfigs` and make it be a `final` class?



##########
checkstyle/import-control.xml:
##########
@@ -605,6 +605,8 @@
         <allow pkg="org.apache.kafka.metadata" />
         <allow pkg="org.eclipse.jetty.client"/>
         <allow class="org.apache.kafka.storage.internals.log.CleanerConfig" />
+        <allow class="org.apache.kafka.server.config.ZkConfig" />
+        <allow class="org.apache.zookeeper.client.ZKClientConfig" />

Review Comment:
   ditto



-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on PR #15075:
URL: https://github.com/apache/kafka/pull/15075#issuecomment-1948922545

   Hello @mimaison @ijuma 
   
   This PR is ready for review.
   Please, take a look.


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 merged PR #15075:
URL: https://github.com/apache/kafka/pull/15075


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on PR #15075:
URL: https://github.com/apache/kafka/pull/15075#issuecomment-1963486539

   Hello @mimaison @ijuma
   
   Can you, please, take a look?


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on PR #15075:
URL: https://github.com/apache/kafka/pull/15075#issuecomment-2024632660

   @OmniaGM Thanks for noticing. https://github.com/apache/kafka/pull/15614/files prepared


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #15075:
URL: https://github.com/apache/kafka/pull/15075#discussion_r1539504425


##########
server/src/main/java/org/apache/kafka/server/config/ZkConfig.java:
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.server.config;
+
+import org.apache.zookeeper.client.ZKClientConfig;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class ZkConfig {

Review Comment:
   Done.



##########
checkstyle/import-control.xml:
##########
@@ -605,6 +605,8 @@
         <allow pkg="org.apache.kafka.metadata" />
         <allow pkg="org.eclipse.jetty.client"/>
         <allow class="org.apache.kafka.storage.internals.log.CleanerConfig" />
+        <allow class="org.apache.kafka.server.config.ZkConfig" />
+        <allow class="org.apache.zookeeper.client.ZKClientConfig" />

Review Comment:
   Done.



-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #15075:
URL: https://github.com/apache/kafka/pull/15075#issuecomment-2017574947

   @nizhikov please rebase the code, and I will take a look later


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #15075:
URL: https://github.com/apache/kafka/pull/15075#discussion_r1539513879


##########
server/src/main/java/org/apache/kafka/server/config/ZkConfig.java:
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.server.config;
+
+import org.apache.zookeeper.client.ZKClientConfig;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class ZkConfig {
+    /** ********* Zookeeper Configuration ***********/
+    public static final String ZK_CONNECT_PROP = "zookeeper.connect";
+    public static final String ZK_SESSION_TIMEOUT_MS_PROP = "zookeeper.session.timeout.ms";
+    public static final String ZK_CONNECTION_TIMEOUT_MS_PROP = "zookeeper.connection.timeout.ms";
+    public static final String ZK_ENABLE_SECURE_ACLS_PROP = "zookeeper.set.acl";
+    public static final String ZK_MAX_IN_FLIGHT_REQUESTS_PROP = "zookeeper.max.in.flight.requests";
+    public static final String ZK_SSL_CLIENT_ENABLE_PROP = "zookeeper.ssl.client.enable";
+    public static final String ZK_CLIENT_CNXN_SOCKET_PROP = "zookeeper.clientCnxnSocket";
+    public static final String ZK_SSL_KEY_STORE_LOCATION_PROP = "zookeeper.ssl.keystore.location";
+    public static final String ZK_SSL_KEY_STORE_PASSWORD_PROP = "zookeeper.ssl.keystore.password";
+    public static final String ZK_SSL_KEY_STORE_TYPE_PROP = "zookeeper.ssl.keystore.type";
+    public static final String ZK_SSL_TRUST_STORE_LOCATION_PROP = "zookeeper.ssl.truststore.location";
+    public static final String ZK_SSL_TRUST_STORE_PASSWORD_PROP = "zookeeper.ssl.truststore.password";
+    public static final String ZK_SSL_TRUST_STORE_TYPE_PROP = "zookeeper.ssl.truststore.type";
+    public static final String ZK_SSL_PROTOCOL_PROP = "zookeeper.ssl.protocol";
+    public static final String ZK_SSL_ENABLED_PROTOCOLS_PROP = "zookeeper.ssl.enabled.protocols";
+    public static final String ZK_SSL_CIPHER_SUITES_PROP = "zookeeper.ssl.cipher.suites";
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_PROP = "zookeeper.ssl.endpoint.identification.algorithm";
+    public static final String ZK_SSL_CRL_ENABLE_PROP = "zookeeper.ssl.crl.enable";
+    public static final String ZK_SSL_OCSP_ENABLE_PROP = "zookeeper.ssl.ocsp.enable";
+
+    // a map from the Kafka config to the corresponding ZooKeeper Java system property
+    public static final Map<String, String> ZK_SSL_CONFIG_TO_SYSTEM_PROPERTY_MAP;
+
+    public static final String ZK_CONNECT_DOC = "Specifies the ZooKeeper connection string in the form <code>hostname:port</code> where host and port are the " +
+            "host and port of a ZooKeeper server. To allow connecting through other ZooKeeper nodes when that ZooKeeper machine is " +
+            "down you can also specify multiple hosts in the form <code>hostname1:port1,hostname2:port2,hostname3:port3</code>.\n" +
+            "The server can also have a ZooKeeper chroot path as part of its ZooKeeper connection string which puts its data under some path in the global ZooKeeper namespace. " +
+            "For example to give a chroot path of <code>/chroot/path</code> you would give the connection string as <code>hostname1:port1,hostname2:port2,hostname3:port3/chroot/path</code>.";
+    public static final String ZK_SESSION_TIMEOUT_MS_DOC = "Zookeeper session timeout";
+    public static final String ZK_CONNECTION_TIMEOUT_MS_DOC = "The max time that the client waits to establish a connection to ZooKeeper. If not set, the value in " + ZK_SESSION_TIMEOUT_MS_PROP + " is used";
+    public static final String ZK_ENABLE_SECURE_ACLS_DOC = "Set client to use secure ACLs";
+    public static final String ZK_MAX_IN_FLIGHT_REQUESTS_DOC = "The maximum number of unacknowledged requests the client will send to ZooKeeper before blocking.";
+    public static final String ZK_SSL_CLIENT_ENABLE_DOC;
+    public static final String ZK_CLIENT_CNXN_SOCKET_DOC;
+    public static final String ZK_SSL_KEY_STORE_LOCATION_DOC;
+    public static final String ZK_SSL_KEY_STORE_PASSWORD_DOC;
+    public static final String ZK_SSL_KEY_STORE_TYPE_DOC;
+    public static final String ZK_SSL_TRUST_STORE_LOCATION_DOC;
+    public static final String ZK_SSL_TRUST_STORE_PASSWORD_DOC;
+    public static final String ZK_SSL_TRUST_STORE_TYPE_DOC;
+    public static final String ZK_SSL_PROTOCOL_DOC;
+    public static final String ZK_SSL_ENABLED_PROTOCOLS_DOC;
+    public static final String ZK_SSL_CIPHER_SUITES_DOC;
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_DOC;
+    public static final String ZK_SSL_CRL_ENABLE_DOC;
+    public static final String ZK_SSL_OCSP_ENABLE_DOC;
+
+    public static final int ZK_SESSION_TIMEOUT_MS = 18000;
+    public static final boolean ZK_ENABLE_SECURE_ACLS = false;
+    public static final int ZK_MAX_IN_FLIGHT_REQUESTS = 10;
+    public static final boolean ZK_SSL_CLIENT_ENABLE = false;
+    public static final String ZK_SSL_PROTOCOL = "TLSv1.2";
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM = "HTTPS";
+    public static final boolean ZK_SSL_CRL_ENABLE = false;
+    public static final boolean ZK_SSL_OCSP_ENABLE = false;
+
+    static {
+        Map<String, String> zkSslConfigToSystemPropertyMap = new HashMap<>();
+
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CLIENT_ENABLE_PROP, ZKClientConfig.SECURE_CLIENT);
+        zkSslConfigToSystemPropertyMap.put(ZK_CLIENT_CNXN_SOCKET_PROP, ZKClientConfig.ZOOKEEPER_CLIENT_CNXN_SOCKET);
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_KEY_STORE_LOCATION_PROP, "zookeeper.ssl.keyStore.location");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_KEY_STORE_PASSWORD_PROP, "zookeeper.ssl.keyStore.password");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_KEY_STORE_TYPE_PROP, "zookeeper.ssl.keyStore.type");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_TRUST_STORE_LOCATION_PROP, "zookeeper.ssl.trustStore.location");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_TRUST_STORE_PASSWORD_PROP, "zookeeper.ssl.trustStore.password");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_TRUST_STORE_TYPE_PROP, "zookeeper.ssl.trustStore.type");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_PROTOCOL_PROP, "zookeeper.ssl.protocol");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_ENABLED_PROTOCOLS_PROP, "zookeeper.ssl.enabledProtocols");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CIPHER_SUITES_PROP, "zookeeper.ssl.ciphersuites");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_PROP, "zookeeper.ssl.hostnameVerification");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CRL_ENABLE_PROP, "zookeeper.ssl.crl");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_OCSP_ENABLE_PROP, "zookeeper.ssl.ocsp");
+
+        ZK_SSL_CONFIG_TO_SYSTEM_PROPERTY_MAP = Collections.unmodifiableMap(zkSslConfigToSystemPropertyMap);
+
+        ZK_SSL_CLIENT_ENABLE_DOC = "Set client to use TLS when connecting to ZooKeeper." +

Review Comment:
   Done



##########
server/src/main/java/org/apache/kafka/server/config/ZkConfig.java:
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.server.config;
+
+import org.apache.zookeeper.client.ZKClientConfig;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class ZkConfig {
+    /** ********* Zookeeper Configuration ***********/
+    public static final String ZK_CONNECT_PROP = "zookeeper.connect";
+    public static final String ZK_SESSION_TIMEOUT_MS_PROP = "zookeeper.session.timeout.ms";
+    public static final String ZK_CONNECTION_TIMEOUT_MS_PROP = "zookeeper.connection.timeout.ms";
+    public static final String ZK_ENABLE_SECURE_ACLS_PROP = "zookeeper.set.acl";
+    public static final String ZK_MAX_IN_FLIGHT_REQUESTS_PROP = "zookeeper.max.in.flight.requests";
+    public static final String ZK_SSL_CLIENT_ENABLE_PROP = "zookeeper.ssl.client.enable";
+    public static final String ZK_CLIENT_CNXN_SOCKET_PROP = "zookeeper.clientCnxnSocket";
+    public static final String ZK_SSL_KEY_STORE_LOCATION_PROP = "zookeeper.ssl.keystore.location";
+    public static final String ZK_SSL_KEY_STORE_PASSWORD_PROP = "zookeeper.ssl.keystore.password";
+    public static final String ZK_SSL_KEY_STORE_TYPE_PROP = "zookeeper.ssl.keystore.type";
+    public static final String ZK_SSL_TRUST_STORE_LOCATION_PROP = "zookeeper.ssl.truststore.location";
+    public static final String ZK_SSL_TRUST_STORE_PASSWORD_PROP = "zookeeper.ssl.truststore.password";
+    public static final String ZK_SSL_TRUST_STORE_TYPE_PROP = "zookeeper.ssl.truststore.type";
+    public static final String ZK_SSL_PROTOCOL_PROP = "zookeeper.ssl.protocol";
+    public static final String ZK_SSL_ENABLED_PROTOCOLS_PROP = "zookeeper.ssl.enabled.protocols";
+    public static final String ZK_SSL_CIPHER_SUITES_PROP = "zookeeper.ssl.cipher.suites";
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_PROP = "zookeeper.ssl.endpoint.identification.algorithm";
+    public static final String ZK_SSL_CRL_ENABLE_PROP = "zookeeper.ssl.crl.enable";
+    public static final String ZK_SSL_OCSP_ENABLE_PROP = "zookeeper.ssl.ocsp.enable";
+
+    // a map from the Kafka config to the corresponding ZooKeeper Java system property
+    public static final Map<String, String> ZK_SSL_CONFIG_TO_SYSTEM_PROPERTY_MAP;
+
+    public static final String ZK_CONNECT_DOC = "Specifies the ZooKeeper connection string in the form <code>hostname:port</code> where host and port are the " +
+            "host and port of a ZooKeeper server. To allow connecting through other ZooKeeper nodes when that ZooKeeper machine is " +
+            "down you can also specify multiple hosts in the form <code>hostname1:port1,hostname2:port2,hostname3:port3</code>.\n" +
+            "The server can also have a ZooKeeper chroot path as part of its ZooKeeper connection string which puts its data under some path in the global ZooKeeper namespace. " +
+            "For example to give a chroot path of <code>/chroot/path</code> you would give the connection string as <code>hostname1:port1,hostname2:port2,hostname3:port3/chroot/path</code>.";
+    public static final String ZK_SESSION_TIMEOUT_MS_DOC = "Zookeeper session timeout";
+    public static final String ZK_CONNECTION_TIMEOUT_MS_DOC = "The max time that the client waits to establish a connection to ZooKeeper. If not set, the value in " + ZK_SESSION_TIMEOUT_MS_PROP + " is used";
+    public static final String ZK_ENABLE_SECURE_ACLS_DOC = "Set client to use secure ACLs";
+    public static final String ZK_MAX_IN_FLIGHT_REQUESTS_DOC = "The maximum number of unacknowledged requests the client will send to ZooKeeper before blocking.";
+    public static final String ZK_SSL_CLIENT_ENABLE_DOC;
+    public static final String ZK_CLIENT_CNXN_SOCKET_DOC;
+    public static final String ZK_SSL_KEY_STORE_LOCATION_DOC;
+    public static final String ZK_SSL_KEY_STORE_PASSWORD_DOC;
+    public static final String ZK_SSL_KEY_STORE_TYPE_DOC;
+    public static final String ZK_SSL_TRUST_STORE_LOCATION_DOC;
+    public static final String ZK_SSL_TRUST_STORE_PASSWORD_DOC;
+    public static final String ZK_SSL_TRUST_STORE_TYPE_DOC;
+    public static final String ZK_SSL_PROTOCOL_DOC;
+    public static final String ZK_SSL_ENABLED_PROTOCOLS_DOC;
+    public static final String ZK_SSL_CIPHER_SUITES_DOC;
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_DOC;
+    public static final String ZK_SSL_CRL_ENABLE_DOC;
+    public static final String ZK_SSL_OCSP_ENABLE_DOC;
+
+    public static final int ZK_SESSION_TIMEOUT_MS = 18000;
+    public static final boolean ZK_ENABLE_SECURE_ACLS = false;
+    public static final int ZK_MAX_IN_FLIGHT_REQUESTS = 10;
+    public static final boolean ZK_SSL_CLIENT_ENABLE = false;
+    public static final String ZK_SSL_PROTOCOL = "TLSv1.2";
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM = "HTTPS";
+    public static final boolean ZK_SSL_CRL_ENABLE = false;
+    public static final boolean ZK_SSL_OCSP_ENABLE = false;
+
+    static {
+        Map<String, String> zkSslConfigToSystemPropertyMap = new HashMap<>();
+
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CLIENT_ENABLE_PROP, ZKClientConfig.SECURE_CLIENT);

Review Comment:
   Done.



-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #15075:
URL: https://github.com/apache/kafka/pull/15075#discussion_r1540685634


##########
server/src/main/java/org/apache/kafka/server/config/ZkConfig.java:
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.server.config;
+
+import org.apache.zookeeper.client.ZKClientConfig;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class ZkConfig {
+    /** ********* Zookeeper Configuration ***********/
+    public static final String ZK_CONNECT_PROP = "zookeeper.connect";
+    public static final String ZK_SESSION_TIMEOUT_MS_PROP = "zookeeper.session.timeout.ms";
+    public static final String ZK_CONNECTION_TIMEOUT_MS_PROP = "zookeeper.connection.timeout.ms";
+    public static final String ZK_ENABLE_SECURE_ACLS_PROP = "zookeeper.set.acl";
+    public static final String ZK_MAX_IN_FLIGHT_REQUESTS_PROP = "zookeeper.max.in.flight.requests";
+    public static final String ZK_SSL_CLIENT_ENABLE_PROP = "zookeeper.ssl.client.enable";
+    public static final String ZK_CLIENT_CNXN_SOCKET_PROP = "zookeeper.clientCnxnSocket";
+    public static final String ZK_SSL_KEY_STORE_LOCATION_PROP = "zookeeper.ssl.keystore.location";
+    public static final String ZK_SSL_KEY_STORE_PASSWORD_PROP = "zookeeper.ssl.keystore.password";
+    public static final String ZK_SSL_KEY_STORE_TYPE_PROP = "zookeeper.ssl.keystore.type";
+    public static final String ZK_SSL_TRUST_STORE_LOCATION_PROP = "zookeeper.ssl.truststore.location";
+    public static final String ZK_SSL_TRUST_STORE_PASSWORD_PROP = "zookeeper.ssl.truststore.password";
+    public static final String ZK_SSL_TRUST_STORE_TYPE_PROP = "zookeeper.ssl.truststore.type";
+    public static final String ZK_SSL_PROTOCOL_PROP = "zookeeper.ssl.protocol";
+    public static final String ZK_SSL_ENABLED_PROTOCOLS_PROP = "zookeeper.ssl.enabled.protocols";
+    public static final String ZK_SSL_CIPHER_SUITES_PROP = "zookeeper.ssl.cipher.suites";
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_PROP = "zookeeper.ssl.endpoint.identification.algorithm";
+    public static final String ZK_SSL_CRL_ENABLE_PROP = "zookeeper.ssl.crl.enable";
+    public static final String ZK_SSL_OCSP_ENABLE_PROP = "zookeeper.ssl.ocsp.enable";
+
+    // a map from the Kafka config to the corresponding ZooKeeper Java system property
+    public static final Map<String, String> ZK_SSL_CONFIG_TO_SYSTEM_PROPERTY_MAP;
+
+    public static final String ZK_CONNECT_DOC = "Specifies the ZooKeeper connection string in the form <code>hostname:port</code> where host and port are the " +
+            "host and port of a ZooKeeper server. To allow connecting through other ZooKeeper nodes when that ZooKeeper machine is " +
+            "down you can also specify multiple hosts in the form <code>hostname1:port1,hostname2:port2,hostname3:port3</code>.\n" +
+            "The server can also have a ZooKeeper chroot path as part of its ZooKeeper connection string which puts its data under some path in the global ZooKeeper namespace. " +
+            "For example to give a chroot path of <code>/chroot/path</code> you would give the connection string as <code>hostname1:port1,hostname2:port2,hostname3:port3/chroot/path</code>.";
+    public static final String ZK_SESSION_TIMEOUT_MS_DOC = "Zookeeper session timeout";
+    public static final String ZK_CONNECTION_TIMEOUT_MS_DOC = "The max time that the client waits to establish a connection to ZooKeeper. If not set, the value in " + ZK_SESSION_TIMEOUT_MS_PROP + " is used";
+    public static final String ZK_ENABLE_SECURE_ACLS_DOC = "Set client to use secure ACLs";
+    public static final String ZK_MAX_IN_FLIGHT_REQUESTS_DOC = "The maximum number of unacknowledged requests the client will send to ZooKeeper before blocking.";
+    public static final String ZK_SSL_CLIENT_ENABLE_DOC;
+    public static final String ZK_CLIENT_CNXN_SOCKET_DOC;
+    public static final String ZK_SSL_KEY_STORE_LOCATION_DOC;
+    public static final String ZK_SSL_KEY_STORE_PASSWORD_DOC;
+    public static final String ZK_SSL_KEY_STORE_TYPE_DOC;
+    public static final String ZK_SSL_TRUST_STORE_LOCATION_DOC;
+    public static final String ZK_SSL_TRUST_STORE_PASSWORD_DOC;
+    public static final String ZK_SSL_TRUST_STORE_TYPE_DOC;
+    public static final String ZK_SSL_PROTOCOL_DOC;
+    public static final String ZK_SSL_ENABLED_PROTOCOLS_DOC;
+    public static final String ZK_SSL_CIPHER_SUITES_DOC;
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_DOC;
+    public static final String ZK_SSL_CRL_ENABLE_DOC;
+    public static final String ZK_SSL_OCSP_ENABLE_DOC;
+
+    public static final int ZK_SESSION_TIMEOUT_MS = 18000;
+    public static final boolean ZK_ENABLE_SECURE_ACLS = false;
+    public static final int ZK_MAX_IN_FLIGHT_REQUESTS = 10;
+    public static final boolean ZK_SSL_CLIENT_ENABLE = false;
+    public static final String ZK_SSL_PROTOCOL = "TLSv1.2";
+    public static final String ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM = "HTTPS";
+    public static final boolean ZK_SSL_CRL_ENABLE = false;
+    public static final boolean ZK_SSL_OCSP_ENABLE = false;
+
+    static {
+        Map<String, String> zkSslConfigToSystemPropertyMap = new HashMap<>();
+
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CLIENT_ENABLE_PROP, ZKClientConfig.SECURE_CLIENT);
+        zkSslConfigToSystemPropertyMap.put(ZK_CLIENT_CNXN_SOCKET_PROP, ZKClientConfig.ZOOKEEPER_CLIENT_CNXN_SOCKET);
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_KEY_STORE_LOCATION_PROP, "zookeeper.ssl.keyStore.location");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_KEY_STORE_PASSWORD_PROP, "zookeeper.ssl.keyStore.password");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_KEY_STORE_TYPE_PROP, "zookeeper.ssl.keyStore.type");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_TRUST_STORE_LOCATION_PROP, "zookeeper.ssl.trustStore.location");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_TRUST_STORE_PASSWORD_PROP, "zookeeper.ssl.trustStore.password");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_TRUST_STORE_TYPE_PROP, "zookeeper.ssl.trustStore.type");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_PROTOCOL_PROP, "zookeeper.ssl.protocol");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_ENABLED_PROTOCOLS_PROP, "zookeeper.ssl.enabledProtocols");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CIPHER_SUITES_PROP, "zookeeper.ssl.ciphersuites");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_PROP, "zookeeper.ssl.hostnameVerification");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_CRL_ENABLE_PROP, "zookeeper.ssl.crl");
+        zkSslConfigToSystemPropertyMap.put(ZK_SSL_OCSP_ENABLE_PROP, "zookeeper.ssl.ocsp");
+
+        ZK_SSL_CONFIG_TO_SYSTEM_PROPERTY_MAP = Collections.unmodifiableMap(zkSslConfigToSystemPropertyMap);
+
+        ZK_SSL_CLIENT_ENABLE_DOC = "Set client to use TLS when connecting to ZooKeeper." +

Review Comment:
   oh, nice finding. please ignore my previous comment :)



-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on PR #15075:
URL: https://github.com/apache/kafka/pull/15075#issuecomment-2022645115

   @chia7712 CI are ready and seems OK for me.


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on PR #15075:
URL: https://github.com/apache/kafka/pull/15075#issuecomment-2017604728

   @chia7712 Done.
   
   Please, note, there are several other PR's with same goal #15569 #15575 which are close to mergeable state in my opinion.


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on PR #15075:
URL: https://github.com/apache/kafka/pull/15075#issuecomment-2022177651

   @chia7712 Conflicts resolved.


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on PR #15075:
URL: https://github.com/apache/kafka/pull/15075#issuecomment-2020778443

   @chia7712 All your comments resolved. Please, take a look one more time.


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "OmniaGM (via GitHub)" <gi...@apache.org>.
OmniaGM commented on PR #15075:
URL: https://github.com/apache/kafka/pull/15075#issuecomment-2024606943

   @nizhikov it would be nice if we have a followup cleanup on this to change PROP suffix to CONFIG as this seems to be the pattern for others and am doing the same for the rest of KafkaConfig properties. 


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on PR #15075:
URL: https://github.com/apache/kafka/pull/15075#issuecomment-1880988000

   Hello @mimaison 
   
   This PR based on #14871 and includes changes mad in it.
   I think it will be better to review #14871 and after it returns to these changes.
   
   Will add "[WIP]" lablel to this PR.
   Sorry for any inconvinience.
   
   
   


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-14588 ZK configuration moved to ZkConfig [kafka]

Posted by "mimaison (via GitHub)" <gi...@apache.org>.
mimaison commented on code in PR #15075:
URL: https://github.com/apache/kafka/pull/15075#discussion_r1444500990


##########
server-common/src/main/java/org/apache/kafka/server/metrics/ClientMetricsConfigs.java:
##########


Review Comment:
   These files don't seem to be related to ZooKeeper configs, why are we moving them in this PR?



##########
core/src/main/scala/kafka/server/DynamicConfig.scala:
##########
@@ -35,87 +33,22 @@ import scala.jdk.CollectionConverters._
 object DynamicConfig {
 
   object Broker {
-    // Properties
-    val LeaderReplicationThrottledRateProp = "leader.replication.throttled.rate"

Review Comment:
   Do we have to move these fields in this PR? These are not ZooKeeper configs



-- 
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-unsubscribe@kafka.apache.org

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