Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove unused class arguments
  • Loading branch information
liyinan926 committed Dec 23, 2017
commit a3cd71d86fb8047ed0284ce6a245bf9e12179211
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ private[spark] class InitContainerBootstrap(
imagePullPolicy: String,
jarsDownloadPath: String,
filesDownloadPath: String,
downloadTimeoutMinutes: Long,
configMapName: String,
configMapKey: String,
sparkRole: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ import org.apache.spark.util.SystemClock
import org.apache.spark.util.Utils

/**
* Constructs the complete list of driver configuration steps to run to deploy the Spark driver.
* Figures out and returns the complete ordered list of needed DriverConfigurationSteps to
* configure the Spark driver pod. The returned steps will be applied one by one in the given
* order to produce a final KubernetesDriverSpec that is used in KubernetesClientApplication
* to construct and create the driver pod.
*/
private[spark] class DriverConfigOrchestrator(
namespace: String,
kubernetesAppId: String,
launchTime: Long,
mainAppResource: Option[MainAppResource],
Expand Down Expand Up @@ -85,7 +87,7 @@ private[spark] class DriverConfigOrchestrator(
appArgs,
sparkConf)

val driverAddressStep = new DriverServiceBootstrapStep(
val serviceBootstrapStep = new DriverServiceBootstrapStep(
kubernetesResourceNamePrefix,
allDriverLabels,
sparkConf,
Expand Down Expand Up @@ -126,14 +128,11 @@ private[spark] class DriverConfigOrchestrator(
val mayBeInitContainerBootstrapStep =
if (areAnyFilesNonContainerLocal(sparkJars ++ sparkFiles)) {
val orchestrator = new InitContainerConfigOrchestrator(
namespace,
kubernetesResourceNamePrefix,
sparkJars,
sparkFiles,
jarsDownloadPath,
filesDownloadPath,
imagePullPolicy,
allDriverLabels,
initContainerConfigMapName,
INIT_CONTAINER_PROPERTIES_FILE_NAME,
sparkConf)
Expand All @@ -155,7 +154,7 @@ private[spark] class DriverConfigOrchestrator(

Seq(
initialSubmissionStep,
driverAddressStep,
serviceBootstrapStep,
kubernetesCredentialsStep) ++
maybeDependencyResolutionStep.toSeq ++
mayBeInitContainerBootstrapStep.toSeq ++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ private[spark] class KubernetesClientApplication extends SparkApplication {
val watcher = new LoggingPodStatusWatcherImpl(kubernetesAppId, loggingInterval)

val orchestrator = new DriverConfigOrchestrator(
namespace,
kubernetesAppId,
launchTime,
clientArguments.mainAppResource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ private[spark] class BaseInitContainerConfigurationStep(
initContainer = bootstrapped.initContainer,
driverContainer = bootstrapped.mainContainer,
driverPod = bootstrapped.pod,
properties = baseInitContainerConfig)
properties = spec.properties ++ baseInitContainerConfig)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,17 @@ import org.apache.spark.deploy.k8s.Config._
import org.apache.spark.deploy.k8s.Constants._

/**
* Returns the complete ordered list of steps required to configure the init-container. This is
* only used when there are remote application dependencies to localize.
* Figures out and returns the complete ordered list of InitContainerConfigurationSteps required to
* configure an init-container. The returned steps will be applied in the given order to produce a
* final InitContainerSpec that is used to construct an init-container. This is only used when an
* init-container is needed, i.e., when there are remote application dependencies to localize.
*/
private[spark] class InitContainerConfigOrchestrator(
namespace: String,
resourceNamePrefix: String,
sparkJars: Seq[String],
sparkFiles: Seq[String],
jarsDownloadPath: String,
filesDownloadPath: String,
imagePullPolicy: String,
driverLabels: Map[String, String],
configMapName: String,
configMapKey: String,
sparkConf: SparkConf) {
Expand All @@ -42,15 +41,13 @@ private[spark] class InitContainerConfigOrchestrator(
.get(INIT_CONTAINER_IMAGE)
.getOrElse(throw new SparkException(
"Must specify the init-container image when there are remote dependencies"))
private val downloadTimeoutMinutes = sparkConf.get(INIT_CONTAINER_MOUNT_TIMEOUT)

def getAllConfigurationSteps: Seq[InitContainerConfigurationStep] = {
val initContainerBootstrap = new InitContainerBootstrap(
initContainerImage,
imagePullPolicy,
jarsDownloadPath,
filesDownloadPath,
downloadTimeoutMinutes,
configMapName,
configMapKey,
SPARK_POD_DRIVER_ROLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ private[spark] class KubernetesClusterManager extends ExternalClusterManager wit
sparkConf.get(CONTAINER_IMAGE_PULL_POLICY),
sparkConf.get(JARS_DOWNLOAD_LOCATION),
sparkConf.get(FILES_DOWNLOAD_LOCATION),
sparkConf.get(INIT_CONTAINER_MOUNT_TIMEOUT),
configMap,
configMapKey,
SPARK_POD_EXECUTOR_ROLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import org.apache.spark.deploy.k8s.submit.steps._

class DriverConfigOrchestratorSuite extends SparkFunSuite {

private val NAMESPACE = "default"
private val DRIVER_IMAGE = "driver-image"
private val IC_IMAGE = "init-container-image"
private val APP_ID = "spark-app-id"
Expand All @@ -39,7 +38,6 @@ class DriverConfigOrchestratorSuite extends SparkFunSuite {
.set(DRIVER_CONTAINER_IMAGE, DRIVER_IMAGE)
val mainAppResource = JavaMainAppResource("local:///var/apps/jars/main.jar")
val orchestrator = new DriverConfigOrchestrator(
NAMESPACE,
APP_ID,
LAUNCH_TIME,
Some(mainAppResource),
Expand All @@ -60,7 +58,6 @@ class DriverConfigOrchestratorSuite extends SparkFunSuite {
val sparkConf = new SparkConf(false)
.set(DRIVER_CONTAINER_IMAGE, DRIVER_IMAGE)
val orchestrator = new DriverConfigOrchestrator(
NAMESPACE,
APP_ID,
LAUNCH_TIME,
Option.empty,
Expand All @@ -83,7 +80,6 @@ class DriverConfigOrchestratorSuite extends SparkFunSuite {
.set("spark.jars", "hdfs://localhost:9000/var/apps/jars/jar1.jar")
val mainAppResource = JavaMainAppResource("local:///var/apps/jars/main.jar")
val orchestrator = new DriverConfigOrchestrator(
NAMESPACE,
APP_ID,
LAUNCH_TIME,
Some(mainAppResource),
Expand All @@ -107,7 +103,6 @@ class DriverConfigOrchestratorSuite extends SparkFunSuite {
.set(s"$KUBERNETES_DRIVER_SECRETS_PREFIX$SECRET_BAR", SECRET_MOUNT_PATH)
val mainAppResource = JavaMainAppResource("local:///var/apps/jars/main.jar")
val orchestrator = new DriverConfigOrchestrator(
NAMESPACE,
APP_ID,
LAUNCH_TIME,
Some(mainAppResource),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class BaseInitContainerConfigurationStepSuite extends SparkFunSuite with BeforeA
"hdfs://localhost:9000/app/files/file1.txt", "file:///app/files/file2.txt")
private val JARS_DOWNLOAD_PATH = "/var/data/jars"
private val FILES_DOWNLOAD_PATH = "/var/data/files"
private val CONFIG_MAP_NAME = "config-map"
private val CONFIG_MAP_KEY = "config-map-key"
private val POD_LABEL = Map("bootstrap" -> "true")
private val INIT_CONTAINER_NAME = "init-container"
private val DRIVER_CONTAINER_NAME = "driver-container"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,16 @@ import org.apache.spark.deploy.k8s.Constants._

class InitContainerConfigOrchestratorSuite extends SparkFunSuite {

private val NAMESPACE = "namespace"
private val DOCKER_IMAGE = "init-container"
private val APP_RESOURCE_PREFIX = "spark-prefix"
private val SPARK_JARS = Seq(
"hdfs://localhost:9000/app/jars/jar1.jar", "file:///app/jars/jar2.jar")
private val SPARK_FILES = Seq(
"hdfs://localhost:9000/app/files/file1.txt", "file:///app/files/file2.txt")
private val JARS_DOWNLOAD_PATH = "/var/data/jars"
private val FILES_DOWNLOAD_PATH = "/var/data/files"
private val DOCKER_IMAGE_PULL_POLICY: String = "IfNotPresent"
private val APP_ID = "spark-id"
private val CUSTOM_LABEL_KEY = "customLabel"
private val CUSTOM_LABEL_VALUE = "customLabelValue"
private val DEPRECATED_CUSTOM_LABEL_KEY = "deprecatedCustomLabel"
private val DEPRECATED_CUSTOM_LABEL_VALUE = "deprecatedCustomLabelValue"
private val DRIVER_LABELS = Map(
CUSTOM_LABEL_KEY -> CUSTOM_LABEL_VALUE,
DEPRECATED_CUSTOM_LABEL_KEY -> DEPRECATED_CUSTOM_LABEL_VALUE,
SPARK_APP_ID_LABEL -> APP_ID,
SPARK_ROLE_LABEL -> SPARK_POD_DRIVER_ROLE)
private val INIT_CONTAINER_CONFIG_MAP_NAME = "spark-init-config-map"
private val INIT_CONTAINER_CONFIG_MAP_KEY = "spark-init-config-map-key"
private val SECRET_FOO = "foo"
Expand All @@ -54,14 +44,11 @@ class InitContainerConfigOrchestratorSuite extends SparkFunSuite {
.set(s"$KUBERNETES_DRIVER_LABEL_PREFIX$CUSTOM_LABEL_KEY", CUSTOM_LABEL_VALUE)

val orchestrator = new InitContainerConfigOrchestrator(
NAMESPACE,
APP_RESOURCE_PREFIX,
SPARK_JARS.take(1),
SPARK_FILES,
JARS_DOWNLOAD_PATH,
FILES_DOWNLOAD_PATH,
DOCKER_IMAGE_PULL_POLICY,
DRIVER_LABELS,
INIT_CONTAINER_CONFIG_MAP_NAME,
INIT_CONTAINER_CONFIG_MAP_KEY,
sparkConf)
Expand All @@ -78,14 +65,11 @@ class InitContainerConfigOrchestratorSuite extends SparkFunSuite {
.set(s"$KUBERNETES_DRIVER_SECRETS_PREFIX$SECRET_BAR", SECRET_MOUNT_PATH)

val orchestrator = new InitContainerConfigOrchestrator(
NAMESPACE,
APP_RESOURCE_PREFIX,
SPARK_JARS.take(1),
SPARK_FILES,
JARS_DOWNLOAD_PATH,
FILES_DOWNLOAD_PATH,
DOCKER_IMAGE_PULL_POLICY,
DRIVER_LABELS,
INIT_CONTAINER_CONFIG_MAP_NAME,
INIT_CONTAINER_CONFIG_MAP_KEY,
sparkConf)
Expand Down