-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-23668][K8S] Add config option for passing through k8s Pod.spec.imagePullSecrets #20811
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
Changes from 2 commits
e3a50be
4b8b39a
c13ee6c
4173977
c8fb9fa
0291f0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ package org.apache.spark.deploy.k8s.submit.steps | |
|
|
||
| import scala.collection.JavaConverters._ | ||
|
|
||
| import io.fabric8.kubernetes.api.model.{ContainerBuilder, EnvVarBuilder, EnvVarSourceBuilder, PodBuilder, QuantityBuilder} | ||
| import io.fabric8.kubernetes.api.model._ | ||
|
||
|
|
||
| import org.apache.spark.{SparkConf, SparkException} | ||
| import org.apache.spark.deploy.k8s.Config._ | ||
|
|
@@ -51,6 +51,8 @@ private[spark] class BasicDriverConfigurationStep( | |
| .get(DRIVER_CONTAINER_IMAGE) | ||
| .getOrElse(throw new SparkException("Must specify the driver container image")) | ||
|
|
||
| private val imagePullSecret = sparkConf.get(IMAGE_PULL_SECRET) | ||
|
|
||
| // CPU settings | ||
| private val driverCpuCores = sparkConf.getOption("spark.driver.cores").getOrElse("1") | ||
| private val driverLimitCores = sparkConf.get(KUBERNETES_DRIVER_LIMIT_CORES) | ||
|
|
@@ -132,6 +134,8 @@ private[spark] class BasicDriverConfigurationStep( | |
| case _ => driverContainerWithoutArgs.addToArgs(appArgs: _*).build() | ||
| } | ||
|
|
||
| val imagePullSecrets = imagePullSecret.map(new LocalObjectReference(_)).toList | ||
|
|
||
| val baseDriverPod = new PodBuilder(driverSpec.driverPod) | ||
| .editOrNewMetadata() | ||
| .withName(driverPodName) | ||
|
|
@@ -141,6 +145,7 @@ private[spark] class BasicDriverConfigurationStep( | |
| .withNewSpec() | ||
| .withRestartPolicy("Never") | ||
| .withNodeSelector(nodeSelector.asJava) | ||
| .withImagePullSecrets(imagePullSecrets.asJava) | ||
| .endSpec() | ||
| .build() | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,6 +68,7 @@ private[spark] class ExecutorPodFactory( | |
| .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 imagePullSecret = sparkConf.get(IMAGE_PULL_SECRET) | ||
| private val blockManagerPort = sparkConf | ||
| .getInt("spark.blockmanager.port", DEFAULT_BLOCKMANAGER_PORT) | ||
|
|
||
|
|
@@ -98,6 +99,8 @@ private[spark] class ExecutorPodFactory( | |
| nodeToLocalTaskCount: Map[String, Int]): Pod = { | ||
| val name = s"$executorPodNamePrefix-exec-$executorId" | ||
|
|
||
| val imagePullSecrets = imagePullSecret.map(new LocalObjectReference(_)).toList | ||
|
||
|
|
||
| // hostname must be no longer than 63 characters, so take the last 63 characters of the pod | ||
| // name as the hostname. This preserves uniqueness since the end of name contains | ||
| // executorId | ||
|
|
@@ -193,6 +196,7 @@ private[spark] class ExecutorPodFactory( | |
| .withHostname(hostname) | ||
| .withRestartPolicy("Never") | ||
| .withNodeSelector(nodeSelector.asJava) | ||
| .withImagePullSecrets(imagePullSecrets.asJava) | ||
| .endSpec() | ||
| .build() | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given there's an option
spark.kubernetes.container.image.pullPolicy, we should make this consistent asspark.kubernetes.container.image.pullSecretThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done