pan3793 commented on code in PR #7027: URL: https://github.com/apache/kyuubi/pull/7027#discussion_r2045886034
########## kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala: ########## @@ -167,6 +167,29 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging { TimeUnit.MILLISECONDS) cleanupCanceledAppPodExecutor = ThreadUtils.newDaemonCachedThreadPool( "cleanup-canceled-app-pod-thread") + initializeKubernetesClient(kyuubiConf) + } + + 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) + } + KubernetesInfo(context, namespace) + } + } + + private[kyuubi] def initializeKubernetesClient(kyuubiConf: KyuubiConf): Unit = { + getKubernetesClientInitializeInfo(kyuubiConf).foreach { kubernetesInfo => + try { + getOrCreateKubernetesClient(kubernetesInfo) + } catch { + case e: Throwable => error(s"Failed to initialize Kubernetes client for $kubernetesInfo", e) Review Comment: this also helps the user to identify the configuration issues, I consistently getting reports from some users complain their server can not get engine status for Spark apps running on K8s, due to wrong conf cause server can not instance K8s Client correctly. -- 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-unsubscr...@kyuubi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org For additional commands, e-mail: notifications-h...@kyuubi.apache.org