@@ -23,6 +23,7 @@ import org.apache.spark.deploy.k8s.Config._
23
23
import org .apache .spark .deploy .k8s .Constants ._
24
24
import org .apache .spark .deploy .k8s .submit .{JavaMainAppResource , MainAppResource }
25
25
import org .apache .spark .internal .config .ConfigEntry
26
+ import org .apache .spark .launcher .SparkLauncher
26
27
27
28
private [spark] sealed trait KubernetesRoleSpecificConf
28
29
@@ -105,7 +106,7 @@ private[spark] object KubernetesConf {
105
106
appArgs : Array [String ]): KubernetesConf [KubernetesDriverSpecificConf ] = {
106
107
val sparkConfWithMainAppJar = sparkConf.clone()
107
108
mainAppResource.foreach {
108
- case JavaMainAppResource (res) =>
109
+ case JavaMainAppResource (res) if res != SparkLauncher . NO_RESOURCE =>
109
110
val previousJars = sparkConf
110
111
.getOption(" spark.jars" )
111
112
.map(_.split(" ," ))
@@ -115,6 +116,21 @@ private[spark] object KubernetesConf {
115
116
}
116
117
}
117
118
119
+ sparkConfWithMainAppJar.setJars(
120
+ sparkConfWithMainAppJar.getOption(" spark.jars" )
121
+ .map(_.split(" ," ))
122
+ .getOrElse(Array .empty)
123
+ .map(_.trim)
124
+ .filterNot(_.isEmpty))
125
+
126
+ sparkConfWithMainAppJar.set(" spark.files" ,
127
+ sparkConfWithMainAppJar.getOption(" spark.files" )
128
+ .map(_.split(" ," ))
129
+ .getOrElse(Array .empty)
130
+ .map(_.trim)
131
+ .filterNot(_.isEmpty)
132
+ .mkString(" ," ))
133
+
118
134
val driverCustomLabels = KubernetesUtils .parsePrefixedKeyValuePairs(
119
135
sparkConf, KUBERNETES_DRIVER_LABEL_PREFIX )
120
136
require(! driverCustomLabels.contains(SPARK_APP_ID_LABEL ), " Label with key " +
0 commit comments