You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/04/10 22:20:53 UTC

[GitHub] [spark] vanzin commented on a change in pull request #24305: [SPARK-27294][SS] Add multi-cluster Kafka delegation token

vanzin commented on a change in pull request #24305: [SPARK-27294][SS] Add multi-cluster Kafka delegation token
URL: https://github.com/apache/spark/pull/24305#discussion_r274186648
 
 

 ##########
 File path: external/kafka-0-10-token-provider/src/main/scala/org/apache/spark/kafka010/KafkaTokenSparkConf.scala
 ##########
 @@ -0,0 +1,87 @@
+/*
+ * 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.spark.kafka010
+
+import org.apache.kafka.common.security.auth.SecurityProtocol.SASL_SSL
+
+import org.apache.spark.SparkConf
+import org.apache.spark.internal.Logging
+import org.apache.spark.internal.config.Kafka
+
+private[spark] case class KafkaTokenClusterConf(
+  identifier: String,
+  bootstrapServers: String,
+  securityProtocol: String,
+  kerberosServiceName: String,
+  trustStoreLocation: Option[String],
+  trustStorePassword: Option[String],
+  keyStoreLocation: Option[String],
+  keyStorePassword: Option[String],
+  keyPassword: Option[String],
+  tokenMechanism: String) {
+  override def toString: String = s"KafkaTokenClusterConf{"
+    s"identifier=$identifier, " +
+    s"bootstrapServers=$bootstrapServers, "
+    s"securityProtocol=$securityProtocol, " +
+    s"kerberosServiceName=$kerberosServiceName, " +
+    s"trustStoreLocation=$trustStoreLocation, " +
+    s"trustStorePassword=${trustStorePassword.map(_ => "xxx")}, " +
+    s"keyStoreLocation=$keyStoreLocation, "
+    s"keyStorePassword=${keyStorePassword.map(_ => "xxx")}, " +
+    s"keyPassword=${keyPassword.map(_ => "xxx")}, " +
+    s"tokenMechanism=$tokenMechanism}"
+}
+
+private[spark] class KafkaTokenSparkConf(sparkConf: SparkConf) extends Logging {
+  def getClusterIdentifiers(): Array[String] = {
+    val result = sparkConf.get(Kafka.CLUSTERS) match {
 
 Review comment:
   You could use e.g. `sparkConf.getAllWithPrefix("spark.kafka.clusters.")` and avoid having to list cluster names in this config. (You could parse the cluster names from the keys in the returned list.)
   
   Or if you want to keep this, it should be a sequence config (`.toSequence`).
   
   But given the whole change seems to be about exposing the cluster name in a bunch of places, I'm wondering if there isn't a cleaner way to do that?
   
   e.g. don't you have the server name you're connecting to, and then you could check it against the "bootstrapServers" of each cluster-specific config to find the one you're looking for?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org