You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/12/05 10:29:12 UTC

[GitHub] [incubator-kyuubi] ulysses-you commented on a diff in pull request #3869: [K8S][IT][BUG] Fix the issue that connect conf is not used in the jdbc connection string

ulysses-you commented on code in PR #3869:
URL: https://github.com/apache/incubator-kyuubi/pull/3869#discussion_r1039401913


##########
integration-tests/kyuubi-kubernetes-it/src/test/scala/org/apache/kyuubi/kubernetes/test/deployment/KyuubiOnKubernetesTestsSuite.scala:
##########
@@ -112,9 +134,14 @@ class KyuubiOnKubernetesWithClusterSparkTestsSuite
         "spark.submit.deployMode" -> "cluster",
         "spark.kubernetes.file.upload.path" -> s"hdfs://$localhostAddress:$getDFSPort/spark",
         "spark.hadoop.dfs.client.use.datanode.hostname" -> "true",
-        "spark.kubernetes.authenticate.driver.serviceAccountName" -> "spark",
-        "spark.kubernetes.driver.podTemplateFile" -> driverTemplate.getPath,
-        ZK_CLIENT_PORT_ADDRESS.key -> localhostAddress,
-        FRONTEND_THRIFT_BINARY_BIND_HOST.key -> localhostAddress)
+        "spark.kubernetes.authenticate.driver.serviceAccountName" -> "kyuubi",
+        "spark.kubernetes.driver.podTemplateFile" ->
+          s"hdfs://$localhostAddress:$getDFSPort/spark/driver.yml",
+        "spark.kyuubi.frontend.thrift.binary.bind.host" -> miniKubeIp,

Review Comment:
   why not `kyuubiServerIp` ?



##########
integration-tests/kyuubi-kubernetes-it/src/test/scala/org/apache/kyuubi/kubernetes/test/WithKyuubiServerOnKubernetes.scala:
##########
@@ -25,26 +26,30 @@ trait WithKyuubiServerOnKubernetes extends KyuubiFunSuite {
   protected def connectionConf: Map[String, String] = Map.empty
   private val miniKubernetesClient: DefaultKubernetesClient = MiniKube.getKubernetesClient
 
-  protected def getJdbcUrl: String = {
-    val kyuubiServers =
-      miniKubernetesClient.pods().list().getItems
-    assert(kyuubiServers.size() == 1)
-    val kyuubiServer = kyuubiServers.get(0)
+  protected def getJdbcUrl(connectionConf: Map[String, String]): String = {
+    val kyuuubiPod = kyuubiPod
     // Kyuubi server state should be running since mvn compile is quite slowly..
-    if (!"running".equalsIgnoreCase(kyuubiServer.getStatus.getPhase)) {
+    if (!"running".equalsIgnoreCase(kyuuubiPod.getStatus.getPhase)) {
       val log =
         miniKubernetesClient
           .pods()
-          .withName(kyuubiServer.getMetadata.getName)
+          .withName(kyuuubiPod.getMetadata.getName)
           .getLog
       throw new IllegalStateException(
-        s"Kyuubi server pod state error: ${kyuubiServer.getStatus.getPhase}, log:\n$log")
+        s"Kyuubi server pod state error: ${kyuuubiPod.getStatus.getPhase}, log:\n$log")
     }
-    val kyuubiServerIp = MiniKube.getIp
+    val kyuubiServerIp = miniKubeIp
     val kyuubiServerPort =
-      kyuubiServer.getSpec.getContainers.get(0).getPorts.get(0).getHostPort
-    s"jdbc:hive2://$kyuubiServerIp:$kyuubiServerPort/;"
+      kyuuubiPod.getSpec.getContainers.get(0).getPorts.get(0).getHostPort
+    val connectStr = connectionConf.map(kv => kv._1 + "=" + kv._2).mkString("#", ";", "")
+    s"jdbc:hive2://$kyuubiServerIp:$kyuubiServerPort/;$connectStr"
   }
 
-  def getMiniKubeApiMaster: String = miniKubernetesClient.getMasterUrl.toString
+  def miniKubeApiMaster: String = miniKubernetesClient.getMasterUrl.toString
+
+  def kyuubiPod: Pod = miniKubernetesClient.pods().withName("kyuubi-test").get()

Review Comment:
   `lazy val`



##########
integration-tests/kyuubi-kubernetes-it/src/test/scala/org/apache/kyuubi/kubernetes/test/deployment/KyuubiOnKubernetesTestsSuite.scala:
##########
@@ -72,10 +74,17 @@ class KyuubiOnKubernetesWithSparkTestsBase extends WithKyuubiServerOnKubernetes
  *  ------------       -------------------------------------------------      ---------------------
  */
 class KyuubiOnKubernetesWithClientSparkTestsSuite
-  extends KyuubiOnKubernetesWithSparkTestsBase {
+  extends KyuubiOnKubernetesWithSparkTestsBase with SparkQueryTests {
   override protected def connectionConf: Map[String, String] = {
-    super.connectionConf ++ Map("spark.submit.deployMode" -> "client")
+    super.connectionConf ++ Map(
+      "spark.submit.deployMode" -> "client",
+      "spark.driver.host" -> kyuubiServerIp,
+      "kyuubi.frontend.connection.url.use.hostname" -> "false")
   }
+
+  override protected def jdbcUrl: String = getJdbcUrl(connectionConf)
+
+  override protected lazy val user: String = "client"

Review Comment:
   what does this mean ?



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org