Skip to content
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

Fix executor env to include simple authn #1

Merged
merged 2 commits into from
Sep 1, 2017
Merged
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 @@ -60,7 +60,6 @@ package object constants {
private[spark] val ENV_DRIVER_URL = "SPARK_DRIVER_URL"
private[spark] val ENV_EXECUTOR_CORES = "SPARK_EXECUTOR_CORES"
private[spark] val ENV_EXECUTOR_MEMORY = "SPARK_EXECUTOR_MEMORY"
private[spark] val ENV_EXECUTOR_JAVA_OPTS = "SPARK_EXECUTOR_JAVA_OPTS"
private[spark] val ENV_APPLICATION_ID = "SPARK_APPLICATION_ID"
private[spark] val ENV_EXECUTOR_ID = "SPARK_EXECUTOR_ID"
private[spark] val ENV_EXECUTOR_POD_IP = "SPARK_EXECUTOR_POD_IP"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,12 @@ private[spark] class KubernetesClusterSchedulerBackend(
private val executorsToRemove = Collections.newSetFromMap[String](
new ConcurrentHashMap[String, java.lang.Boolean]()).asScala

private val executorExtraJavaOpts = conf.get(
org.apache.spark.internal.config.EXECUTOR_JAVA_OPTIONS)
private val executorExtraClasspath = conf.get(
org.apache.spark.internal.config.EXECUTOR_CLASS_PATH)
private val executorJarsDownloadDir = conf.get(INIT_CONTAINER_JARS_DOWNLOAD_LOCATION)
private val isKerberosEnabled = conf.get(KUBERNETES_KERBEROS_SUPPORT)
private val maybeSimpleAuthentication =
if (isKerberosEnabled) s" -D$HADOOP_SECURITY_AUTHENTICATION=simple" else ""
if (isKerberosEnabled) Some(s"-D$HADOOP_SECURITY_AUTHENTICATION=simple") else None
private val executorLabels = ConfigurationUtils.combinePrefixedKeyValuePairsWithDeprecatedConf(
conf,
KUBERNETES_EXECUTOR_LABEL_PREFIX,
Expand Down Expand Up @@ -455,27 +453,21 @@ private[spark] class KubernetesClusterSchedulerBackend(
val executorCpuQuantity = new QuantityBuilder(false)
.withAmount(executorCores.toString)
.build()
val executorJavaOpts = executorExtraJavaOpts.getOrElse("") + maybeSimpleAuthentication
val executorJavaOptsEnv = if (executorJavaOpts.nonEmpty) {
Some(new EnvVarBuilder()
.withName(ENV_EXECUTOR_JAVA_OPTS)
.withValue(executorJavaOpts)
.build()) } else None
val executorExtraClasspathEnv = executorExtraClasspath.map { cp =>
new EnvVarBuilder()
.withName(ENV_EXECUTOR_EXTRA_CLASSPATH)
.withValue(cp)
.build()
}
val executorExtraJavaOptionsEnv = conf
.get(org.apache.spark.internal.config.EXECUTOR_JAVA_OPTIONS)
.map { opts =>
val delimitedOpts = Utils.splitCommandString(opts)
delimitedOpts.zipWithIndex.map {
case (opt, index) =>
new EnvVarBuilder().withName(s"$ENV_JAVA_OPT_PREFIX$index").withValue(opt).build()
}
}.getOrElse(Seq.empty[EnvVar])
.get(org.apache.spark.internal.config.EXECUTOR_JAVA_OPTIONS)
.map { opts =>
val delimitedOpts = Utils.splitCommandString(opts) ++ maybeSimpleAuthentication
delimitedOpts.zipWithIndex.map {
case (opt, index) =>
new EnvVarBuilder().withName(s"$ENV_JAVA_OPT_PREFIX$index").withValue(opt).build()
}
}.getOrElse(Seq.empty[EnvVar])
val executorEnv = (Seq(
(ENV_EXECUTOR_PORT, executorPort.toString),
(ENV_DRIVER_URL, driverUrl),
Expand Down Expand Up @@ -516,8 +508,6 @@ private[spark] class KubernetesClusterSchedulerBackend(
.addToLimits("memory", executorMemoryLimitQuantity)
.addToRequests("cpu", executorCpuQuantity)
.endResources()
.addToEnv(executorExtraClasspathEnv.toSeq: _*)
.addToEnv(executorJavaOptsEnv.toSeq: _*)
.addAllToEnv(executorEnv.asJava)
.withPorts(requiredPorts.asJava)
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,6 @@ private[spark] class SparkDockerImageBuilder
name,
dockerFile,
new LoggingBuildHandler())
logInfo(s"Built docker image for $name")
}
}