Skip to content

Commit

Permalink
[SPARK-26256][K8S] Fix labels for pod deletion
Browse files Browse the repository at this point in the history
Adds proper labels when deleting executor pods.

Manually with tests.

Closes #23209 from skonto/fix-deletion-labels.

Authored-by: Stavros Kontopoulos <stavros.kontopoulos@lightbend.com>
Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com>
(cherry picked from commit a24e1a1)
Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com>
  • Loading branch information
Stavros Kontopoulos authored and Marcelo Vanzin committed Dec 3, 2018
1 parent f716a47 commit 349e25b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ private[spark] class ExecutorPodsAllocator(
Utils.tryLogNonFatalError {
kubernetesClient
.pods()
.withLabel(SPARK_APP_ID_LABEL, applicationId)
.withLabel(SPARK_ROLE_LABEL, SPARK_POD_EXECUTOR_ROLE)
.withLabel(SPARK_EXECUTOR_ID_LABEL, execId.toString)
.delete()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,15 @@ class ExecutorPodsAllocatorSuite extends SparkFunSuite with BeforeAndAfter {
snapshotsStore.notifySubscribers()
snapshotsStore.replaceSnapshot(Seq.empty[Pod])
waitForExecutorPodsClock.setTime(podCreationTimeout + 1)
when(podOperations.withLabel(SPARK_EXECUTOR_ID_LABEL, "1")).thenReturn(labeledPods)
when(podOperations
.withLabel(SPARK_APP_ID_LABEL, TEST_SPARK_APP_ID))
.thenReturn(podOperations)
when(podOperations
withLabel(SPARK_ROLE_LABEL, SPARK_POD_EXECUTOR_ROLE))
.thenReturn(podOperations)
when(podOperations
.withLabel(SPARK_EXECUTOR_ID_LABEL, "1"))
.thenReturn(labeledPods)
snapshotsStore.notifySubscribers()
verify(labeledPods).delete()
verify(podOperations).create(podWithAttachedContainerForId(2))
Expand Down

0 comments on commit 349e25b

Please sign in to comment.