Skip to content

Commit eed82a0

Browse files
foxishMarcelo Vanzin
authored andcommitted
[SPARK-22992][K8S] Remove assumption of the DNS domain
## What changes were proposed in this pull request? Remove the use of FQDN to access the driver because it assumes that it's set up in a DNS zone - `cluster.local` which is common but not ubiquitous Note that we already access the in-cluster API server through `kubernetes.default.svc`, so, by extension, this should work as well. The alternative is to introduce DNS zones for both of those addresses. ## How was this patch tested? Unit tests cc vanzin liyinan926 mridulm mccheah Author: foxish <[email protected]> Closes #20187 from foxish/cluster.local.
1 parent 40b983c commit eed82a0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/steps/DriverServiceBootstrapStep.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private[spark] class DriverServiceBootstrapStep(
8383
.build()
8484

8585
val namespace = sparkConf.get(KUBERNETES_NAMESPACE)
86-
val driverHostname = s"${driverService.getMetadata.getName}.$namespace.svc.cluster.local"
86+
val driverHostname = s"${driverService.getMetadata.getName}.$namespace.svc"
8787
val resolvedSparkConf = driverSpec.driverSparkConf.clone()
8888
.set(DRIVER_HOST_KEY, driverHostname)
8989
.set("spark.driver.port", driverPort.toString)

resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/submit/steps/DriverServiceBootstrapStepSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class DriverServiceBootstrapStepSuite extends SparkFunSuite with BeforeAndAfter
8585
val resolvedDriverSpec = configurationStep.configureDriver(baseDriverSpec)
8686
val expectedServiceName = SHORT_RESOURCE_NAME_PREFIX +
8787
DriverServiceBootstrapStep.DRIVER_SVC_POSTFIX
88-
val expectedHostName = s"$expectedServiceName.my-namespace.svc.cluster.local"
88+
val expectedHostName = s"$expectedServiceName.my-namespace.svc"
8989
verifySparkConfHostNames(resolvedDriverSpec.driverSparkConf, expectedHostName)
9090
}
9191

@@ -120,7 +120,7 @@ class DriverServiceBootstrapStepSuite extends SparkFunSuite with BeforeAndAfter
120120
val driverService = resolvedDriverSpec.otherKubernetesResources.head.asInstanceOf[Service]
121121
val expectedServiceName = s"spark-10000${DriverServiceBootstrapStep.DRIVER_SVC_POSTFIX}"
122122
assert(driverService.getMetadata.getName === expectedServiceName)
123-
val expectedHostName = s"$expectedServiceName.my-namespace.svc.cluster.local"
123+
val expectedHostName = s"$expectedServiceName.my-namespace.svc"
124124
verifySparkConfHostNames(resolvedDriverSpec.driverSparkConf, expectedHostName)
125125
}
126126

0 commit comments

Comments
 (0)