Skip to content

Commit 49ea488

Browse files
authored
KY-895, add config KUBERNETES_DELETE_DRIVER (apache#376)
1 parent ac0c210 commit 49ea488

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/Config.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,14 @@ private[spark] object Config extends Logging {
459459
.checkValue(delay => delay > 0, "delay must be a positive time value")
460460
.createWithDefaultString("30s")
461461

462+
val KUBERNETES_DELETE_DRIVER =
463+
ConfigBuilder("spark.kubernetes.driver.deleteOnCompleted")
464+
.doc("If set to false then driver pods will not be deleted in case " +
465+
"of completion.")
466+
.version("3.1.1")
467+
.booleanConf
468+
.createWithDefault(true)
469+
462470
val KUBERNETES_DRIVER_LABEL_PREFIX = "spark.kubernetes.driver.label."
463471
val KUBERNETES_DRIVER_ANNOTATION_PREFIX = "spark.kubernetes.driver.annotation."
464472
val KUBERNETES_DRIVER_SERVICE_ANNOTATION_PREFIX = "spark.kubernetes.driver.service.annotation."

resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/LoggingPodStatusWatcher.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ private[k8s] class LoggingPodStatusWatcherImpl(conf: KubernetesDriverConf,
107107
pod.map { p => s"Container final statuses:\n\n${containersDescription(p)}" }
108108
.getOrElse("No containers were found in the driver pod."))
109109
logInfo(s"Application ${conf.appName} with submission ID $sId finished")
110-
pod.map { p => kubernetesClient.pods().withName(p.getMetadata.getName).delete() }
110+
if (conf.get(KUBERNETES_DELETE_DRIVER)) {
111+
pod.map { p => kubernetesClient.pods().withName(p.getMetadata.getName).delete() }
112+
}
111113
}
112114
podCompleted
113115
} else {

0 commit comments

Comments
 (0)