xuefeimiaoao commented on code in PR #3852:
URL: https://github.com/apache/incubator-kyuubi/pull/3852#discussion_r1033078989
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala:
##########
@@ -53,8 +54,42 @@ class SparkProcessBuilder(
Paths.get(sparkHome, "bin", SPARK_SUBMIT_FILE).toFile.getCanonicalPath
}
+ completeMasterUrl()
+
override def mainClass: String =
"org.apache.kyuubi.engine.spark.SparkSQLEngine"
+ /**
+ * Add `spark.master` if KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT
+ * are defined. So we can deploy spark on kubernetes without setting
`spark.master`
+ * explicitly when kyuubi-servers are on kubernetes, which also helps in
case that
+ * api-server is not exposed to us.
+ * Besides, set `spark.master` into kyuubiConf if which is set in
spark-defaults.conf
+ * under SPARK_CONF_DIR.
+ */
+ protected def completeMasterUrl(): Unit = {
+ try {
+ (
+ clusterManager(),
+ sys.env.get(KUBERNETES_SERVICE_HOST),
+ sys.env.get(KUBERNETES_SERVICE_PORT)) match {
+ case (None, Some(kubernetesServiceHost), Some(kubernetesServicePort))
=>
+ // According to
"https://kubernetes.io/docs/concepts/architecture/control-plane-
+ // node-communication/#node-to-control-plane", the API server is
configured to listen
+ // for remote connections on a secure HTTPS port (typically 443), so
we set https here.
+ val masterURL =
s"k8s://https://${kubernetesServiceHost}:${kubernetesServicePort}"
+ conf.set(MASTER_KEY, masterURL)
+ case (Some(clusterManager), _, _) =>
+ // in case that ClusterManager was set in spark-defaults.conf, which
should be set into
+ // KyuubiConf, the one which is used to build sparkSubmit.
+ conf.setIfMissing(MASTER_KEY, clusterManager)
Review Comment:
How about complete spark.master if which is set into spark-defaults.conf and
not in kyuubiConf, in which case spark.master will be lost when build
sparkSubmit.
--
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]