@@ -98,6 +98,7 @@ object SparkSubmit extends CommandLineUtils with Logging {
98
98
" org.apache.spark.deploy.yarn.YarnClusterApplication"
99
99
private [deploy] val REST_CLUSTER_SUBMIT_CLASS = classOf [RestSubmissionClientApp ].getName()
100
100
private [deploy] val STANDALONE_CLUSTER_SUBMIT_CLASS = classOf [ClientApp ].getName()
101
+ private [deploy] val KUBERNETES_CLUSTER_SUBMIT_CLASS = " org.apache.spark.deploy.k8s.submit.Client"
101
102
102
103
// scalastyle:off println
103
104
private [spark] def printVersionAndExit (): Unit = {
@@ -298,6 +299,12 @@ object SparkSubmit extends CommandLineUtils with Logging {
298
299
299
300
if (clusterManager == KUBERNETES ) {
300
301
args.master = Utils .checkAndGetK8sMasterUrl(args.master)
302
+ // Make sure YARN is included in our build if we're trying to use it
303
+ if (! Utils .classIsLoadable(KUBERNETES_CLUSTER_SUBMIT_CLASS ) && ! Utils .isTesting) {
304
+ printErrorAndExit(
305
+ " Could not load KUBERNETES classes. " +
306
+ " This copy of Spark may not have been compiled with KUBERNETES support." )
307
+ }
301
308
}
302
309
303
310
// Fail fast, the following modes are not supported or applicable
@@ -721,7 +728,7 @@ object SparkSubmit extends CommandLineUtils with Logging {
721
728
}
722
729
723
730
if (isKubernetesCluster) {
724
- childMainClass = " org.apache.spark.deploy.k8s.submit.Client "
731
+ childMainClass = KUBERNETES_CLUSTER_SUBMIT_CLASS
725
732
if (args.primaryResource != SparkLauncher .NO_RESOURCE ) {
726
733
childArgs ++= Array (" --primary-java-resource" , args.primaryResource)
727
734
}
0 commit comments