Skip to content

Commit

Permalink
KY-895, add config KUBERNETES_DELETE_DRIVER (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
fishcus authored Jan 10, 2022
1 parent ac0c210 commit 49ea488
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 @@ -459,6 +459,14 @@ private[spark] object Config extends Logging {
.checkValue(delay => delay > 0, "delay must be a positive time value")
.createWithDefaultString("30s")

val KUBERNETES_DELETE_DRIVER =
ConfigBuilder("spark.kubernetes.driver.deleteOnCompleted")
.doc("If set to false then driver pods will not be deleted in case " +
"of completion.")
.version("3.1.1")
.booleanConf
.createWithDefault(true)

val KUBERNETES_DRIVER_LABEL_PREFIX = "spark.kubernetes.driver.label."
val KUBERNETES_DRIVER_ANNOTATION_PREFIX = "spark.kubernetes.driver.annotation."
val KUBERNETES_DRIVER_SERVICE_ANNOTATION_PREFIX = "spark.kubernetes.driver.service.annotation."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ private[k8s] class LoggingPodStatusWatcherImpl(conf: KubernetesDriverConf,
pod.map { p => s"Container final statuses:\n\n${containersDescription(p)}" }
.getOrElse("No containers were found in the driver pod."))
logInfo(s"Application ${conf.appName} with submission ID $sId finished")
pod.map { p => kubernetesClient.pods().withName(p.getMetadata.getName).delete() }
if (conf.get(KUBERNETES_DELETE_DRIVER)) {
pod.map { p => kubernetesClient.pods().withName(p.getMetadata.getName).delete() }
}
}
podCompleted
} else {
Expand Down

0 comments on commit 49ea488

Please sign in to comment.