Skip to content

[SPARK-22807] [Scheduler] Remove config that says docker and replace with container #19995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ class SparkSubmitSuite
"--class", "org.SomeClass",
"--driver-memory", "4g",
"--conf", "spark.kubernetes.namespace=spark",
"--conf", "spark.kubernetes.driver.docker.image=bar",
"--conf", "spark.kubernetes.driver.container.image=bar",
"/home/thejar.jar",
"arg1")
val appArgs = new SparkSubmitArguments(clArgs)
Expand All @@ -412,7 +412,7 @@ class SparkSubmitSuite
conf.get("spark.executor.memory") should be ("5g")
conf.get("spark.driver.memory") should be ("4g")
conf.get("spark.kubernetes.namespace") should be ("spark")
conf.get("spark.kubernetes.driver.docker.image") should be ("bar")
conf.get("spark.kubernetes.driver.container.image") should be ("bar")
}

test("handles confs with flag equivalents") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,20 @@ private[spark] object Config extends Logging {
.stringConf
.createWithDefault("default")

val DRIVER_DOCKER_IMAGE =
ConfigBuilder("spark.kubernetes.driver.docker.image")
.doc("Docker image to use for the driver. Specify this using the standard Docker tag format.")
val DRIVER_CONTAINER_IMAGE =
ConfigBuilder("spark.kubernetes.driver.container.image")
.doc("Container image to use for the driver.")
.stringConf
.createOptional

val EXECUTOR_DOCKER_IMAGE =
ConfigBuilder("spark.kubernetes.executor.docker.image")
.doc("Docker image to use for the executors. Specify this using the standard Docker tag " +
"format.")
val EXECUTOR_CONTAINER_IMAGE =
ConfigBuilder("spark.kubernetes.executor.container.image")
.doc("Container image to use for the executors.")
.stringConf
.createOptional

val DOCKER_IMAGE_PULL_POLICY =
ConfigBuilder("spark.kubernetes.docker.image.pullPolicy")
val CONTAINER_IMAGE_PULL_POLICY =
ConfigBuilder("spark.kubernetes.container.image.pullPolicy")
.doc("Kubernetes image pull policy. Valid values are Always, Never, and IfNotPresent.")
.stringConf
.checkValues(Set("Always", "Never", "IfNotPresent"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private[spark] class DriverConfigurationStepsOrchestrator(
s"$appName-$uuid".toLowerCase.replaceAll("\\.", "-")
}

private val dockerImagePullPolicy = submissionSparkConf.get(DOCKER_IMAGE_PULL_POLICY)
private val imagePullPolicy = submissionSparkConf.get(CONTAINER_IMAGE_PULL_POLICY)
private val jarsDownloadPath = submissionSparkConf.get(JARS_DOWNLOAD_LOCATION)
private val filesDownloadPath = submissionSparkConf.get(FILES_DOWNLOAD_LOCATION)

Expand All @@ -72,7 +72,7 @@ private[spark] class DriverConfigurationStepsOrchestrator(
kubernetesAppId,
kubernetesResourceNamePrefix,
allDriverLabels,
dockerImagePullPolicy,
imagePullPolicy,
appName,
mainClass,
appArgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private[spark] class BaseDriverConfigurationStep(
kubernetesAppId: String,
kubernetesResourceNamePrefix: String,
driverLabels: Map[String, String],
dockerImagePullPolicy: String,
imagePullPolicy: String,
appName: String,
mainClass: String,
appArgs: Array[String],
Expand All @@ -46,9 +46,9 @@ private[spark] class BaseDriverConfigurationStep(
private val driverExtraClasspath = submissionSparkConf.get(
DRIVER_CLASS_PATH)

private val driverDockerImage = submissionSparkConf
.get(DRIVER_DOCKER_IMAGE)
.getOrElse(throw new SparkException("Must specify the driver Docker image"))
private val driverContainerImage = submissionSparkConf
.get(DRIVER_CONTAINER_IMAGE)
.getOrElse(throw new SparkException("Must specify the driver container image"))

// CPU settings
private val driverCpuCores = submissionSparkConf.getOption("spark.driver.cores").getOrElse("1")
Expand Down Expand Up @@ -110,8 +110,8 @@ private[spark] class BaseDriverConfigurationStep(

val driverContainer = new ContainerBuilder(driverSpec.driverContainer)
.withName(DRIVER_CONTAINER_NAME)
.withImage(driverDockerImage)
.withImagePullPolicy(dockerImagePullPolicy)
.withImage(driverContainerImage)
.withImagePullPolicy(imagePullPolicy)
.addAllToEnv(driverCustomEnvs.asJava)
.addToEnv(driverExtraClasspathEnv.toSeq: _*)
.addNewEnv()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ private[spark] class ExecutorPodFactoryImpl(sparkConf: SparkConf)
sparkConf,
KUBERNETES_NODE_SELECTOR_PREFIX)

private val executorDockerImage = sparkConf
.get(EXECUTOR_DOCKER_IMAGE)
.getOrElse(throw new SparkException("Must specify the executor Docker image"))
private val dockerImagePullPolicy = sparkConf.get(DOCKER_IMAGE_PULL_POLICY)
private val executorContainerImage = sparkConf
.get(EXECUTOR_CONTAINER_IMAGE)
.getOrElse(throw new SparkException("Must specify the executor container image"))
private val imagePullPolicy = sparkConf.get(CONTAINER_IMAGE_PULL_POLICY)
private val blockManagerPort = sparkConf
.getInt("spark.blockmanager.port", DEFAULT_BLOCKMANAGER_PORT)

Expand Down Expand Up @@ -166,8 +166,8 @@ private[spark] class ExecutorPodFactoryImpl(sparkConf: SparkConf)

val executorContainer = new ContainerBuilder()
.withName("executor")
.withImage(executorDockerImage)
.withImagePullPolicy(dockerImagePullPolicy)
.withImage(executorContainerImage)
.withImagePullPolicy(imagePullPolicy)
.withNewResources()
.addToRequests("memory", executorMemoryQuantity)
.addToLimits("memory", executorMemoryLimitQuantity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.apache.spark.deploy.k8s.submit

import org.apache.spark.{SparkConf, SparkFunSuite}
import org.apache.spark.deploy.k8s.Config.DRIVER_DOCKER_IMAGE
import org.apache.spark.deploy.k8s.Config.DRIVER_CONTAINER_IMAGE
import org.apache.spark.deploy.k8s.submit.steps._

class DriverConfigurationStepsOrchestratorSuite extends SparkFunSuite {
Expand All @@ -32,7 +32,7 @@ class DriverConfigurationStepsOrchestratorSuite extends SparkFunSuite {

test("Base submission steps with a main app resource.") {
val sparkConf = new SparkConf(false)
.set(DRIVER_DOCKER_IMAGE, DRIVER_IMAGE)
.set(DRIVER_CONTAINER_IMAGE, DRIVER_IMAGE)
val mainAppResource = JavaMainAppResource("local:///var/apps/jars/main.jar")
val orchestrator = new DriverConfigurationStepsOrchestrator(
NAMESPACE,
Expand All @@ -54,7 +54,7 @@ class DriverConfigurationStepsOrchestratorSuite extends SparkFunSuite {

test("Base submission steps without a main app resource.") {
val sparkConf = new SparkConf(false)
.set(DRIVER_DOCKER_IMAGE, DRIVER_IMAGE)
.set(DRIVER_CONTAINER_IMAGE, DRIVER_IMAGE)
val orchestrator = new DriverConfigurationStepsOrchestrator(
NAMESPACE,
APP_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BaseDriverConfigurationStepSuite extends SparkFunSuite {
private val APP_ID = "spark-app-id"
private val RESOURCE_NAME_PREFIX = "spark"
private val DRIVER_LABELS = Map("labelkey" -> "labelvalue")
private val DOCKER_IMAGE_PULL_POLICY = "IfNotPresent"
private val CONTAINER_IMAGE_PULL_POLICY = "IfNotPresent"
private val APP_NAME = "spark-test"
private val MAIN_CLASS = "org.apache.spark.examples.SparkPi"
private val APP_ARGS = Array("arg1", "arg2", "arg 3")
Expand All @@ -47,7 +47,7 @@ class BaseDriverConfigurationStepSuite extends SparkFunSuite {
.set(KUBERNETES_DRIVER_LIMIT_CORES, "4")
.set(org.apache.spark.internal.config.DRIVER_MEMORY.key, "256M")
.set(org.apache.spark.internal.config.DRIVER_MEMORY_OVERHEAD, 200L)
.set(DRIVER_DOCKER_IMAGE, "spark-driver:latest")
.set(DRIVER_CONTAINER_IMAGE, "spark-driver:latest")
.set(s"$KUBERNETES_DRIVER_ANNOTATION_PREFIX$CUSTOM_ANNOTATION_KEY", CUSTOM_ANNOTATION_VALUE)
.set(s"$KUBERNETES_DRIVER_ENV_KEY$DRIVER_CUSTOM_ENV_KEY1", "customDriverEnv1")
.set(s"$KUBERNETES_DRIVER_ENV_KEY$DRIVER_CUSTOM_ENV_KEY2", "customDriverEnv2")
Expand All @@ -56,7 +56,7 @@ class BaseDriverConfigurationStepSuite extends SparkFunSuite {
APP_ID,
RESOURCE_NAME_PREFIX,
DRIVER_LABELS,
DOCKER_IMAGE_PULL_POLICY,
CONTAINER_IMAGE_PULL_POLICY,
APP_NAME,
MAIN_CLASS,
APP_ARGS,
Expand All @@ -71,7 +71,7 @@ class BaseDriverConfigurationStepSuite extends SparkFunSuite {

assert(preparedDriverSpec.driverContainer.getName === DRIVER_CONTAINER_NAME)
assert(preparedDriverSpec.driverContainer.getImage === "spark-driver:latest")
assert(preparedDriverSpec.driverContainer.getImagePullPolicy === DOCKER_IMAGE_PULL_POLICY)
assert(preparedDriverSpec.driverContainer.getImagePullPolicy === CONTAINER_IMAGE_PULL_POLICY)

assert(preparedDriverSpec.driverContainer.getEnv.size === 7)
val envs = preparedDriverSpec.driverContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ExecutorPodFactorySuite extends SparkFunSuite with BeforeAndAfter with Bef
baseConf = new SparkConf()
.set(KUBERNETES_DRIVER_POD_NAME, driverPodName)
.set(KUBERNETES_EXECUTOR_POD_NAME_PREFIX, executorPrefix)
.set(EXECUTOR_DOCKER_IMAGE, executorImage)
.set(EXECUTOR_CONTAINER_IMAGE, executorImage)
}

test("basic executor pod has reasonable defaults") {
Expand Down