miaht94 commented on code in PR #7710:
URL: https://github.com/apache/kyuubi/pull/7710#discussion_r3917485875


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -217,14 +217,27 @@ class KubernetesApplicationOperation extends 
ApplicationOperation with Logging {
   }
 
   private[kyuubi] def getKubernetesClientInitializeInfo(
-      kyuubiConf: KyuubiConf): Seq[KubernetesInfo] = {
-    kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
-      val (context, namespace) = init.split(":") match {
-        case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), 
Some(ns).filterNot(_.isEmpty))
-        case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
-        case _ => (None, None)
+      kyuubiConf: KyuubiConf,
+      environment: Map[String, String] = sys.env): Seq[KubernetesInfo] = {
+    val configuredInitializeInfo =
+      kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init 
=>
+        val (context, namespace) = init.split(":") match {
+          case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), 
Some(ns).filterNot(_.isEmpty))
+          case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
+          case _ => (None, None)
+        }
+        KubernetesInfo(context, namespace)
       }
-      KubernetesInfo(context, namespace)
+    if (configuredInitializeInfo.nonEmpty) {
+      configuredInitializeInfo
+    } else if (environment.get(KUBERNETES_SERVICE_HOST).exists(_.nonEmpty) &&

Review Comment:
   Thanks for pointing it out, i've fixed all the chores above in: 
https://github.com/apache/kyuubi/pull/7710/changes/46f4649af3fd291c7da27c2efa48efeaba0c3a78
   Also changed + reused `Utils.isOnK8s` in: 
https://github.com/apache/kyuubi/pull/7710/changes/cc3e487994367a704e6c951c0e069d1aef19e1fc



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to