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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ private[spark] object Constants {

// Labels
val SPARK_APP_ID_LABEL = "spark-app-selector"
val SPARK_APP_NAME_LABEL = "spark-app-name"
val SPARK_EXECUTOR_ID_LABEL = "spark-exec-id"
val SPARK_RESOURCE_PROFILE_ID_LABEL = "spark-exec-resourceprofile-id"
val SPARK_ROLE_LABEL = "spark-role"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ private[spark] class BasicDriverFeatureStep(conf: KubernetesDriverConf)
.editOrNewMetadata()
.withName(driverPodName)
.addToLabels(conf.labels.asJava)
.addToLabels(SPARK_APP_NAME_LABEL, conf.appName)
.addToAnnotations(conf.annotations.asJava)
.endMetadata()
.editOrNewSpec()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ private[spark] class BasicExecutorFeatureStep(
.withName(name)
.addToLabels(kubernetesConf.labels.asJava)
.addToLabels(SPARK_RESOURCE_PROFILE_ID_LABEL, resourceProfile.id.toString)
.addToLabels(SPARK_APP_NAME_LABEL, kubernetesConf.appName)
.addToAnnotations(kubernetesConf.annotations.asJava)
.addToOwnerReferences(ownerReference.toSeq: _*)
.endMetadata()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class BasicDriverFeatureStepSuite extends SparkFunSuite {

val driverPodMetadata = configuredPod.pod.getMetadata
assert(driverPodMetadata.getName === "spark-driver-pod")
DRIVER_LABELS.foreach { case (k, v) =>
val DEFAULT_LABELS = Map(SPARK_APP_NAME_LABEL-> kubernetesConf.appName)
(DRIVER_LABELS ++ DEFAULT_LABELS).foreach { case (k, v) =>
assert(driverPodMetadata.getLabels.get(k) === v)
}
assert(driverPodMetadata.getAnnotations.asScala === DRIVER_ANNOTATIONS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,15 @@ class BasicExecutorFeatureStepSuite extends SparkFunSuite with BeforeAndAfter {
}

test("basic executor pod has reasonable defaults") {
val step = new BasicExecutorFeatureStep(newExecutorConf(), new SecurityManager(baseConf),
val conf = newExecutorConf()
val step = new BasicExecutorFeatureStep(conf, new SecurityManager(baseConf),
defaultProfile)
val executor = step.configurePod(SparkPod.initialPod())

// The executor pod name and default labels.
assert(executor.pod.getMetadata.getName === s"$RESOURCE_NAME_PREFIX-exec-1")
LABELS.foreach { case (k, v) =>
val DEFAULT_LABELS = Map(SPARK_APP_NAME_LABEL-> conf.appName)
(LABELS ++ DEFAULT_LABELS).foreach { case (k, v) =>
assert(executor.pod.getMetadata.getLabels.get(k) === v)
}
assert(executor.pod.getSpec.getImagePullSecrets.asScala === TEST_IMAGE_PULL_SECRET_OBJECTS)
Expand Down