Skip to content

Commit

Permalink
rename conf 'KUBERNETES_SPARK_DELETE_DRIVER_POD_ON_TERMINATION' to 'K…
Browse files Browse the repository at this point in the history
…UBERNETES_SPARK_CLEANUP_TERMINATED_DRIVER_POD'
  • Loading branch information
liaoyt authored Nov 20, 2023
1 parent 4d970fa commit 4caf8b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1231,18 +1231,18 @@ object KyuubiConf {
.checkValue(_ > 0, "must be positive number")
.createWithDefault(Duration.ofMinutes(5).toMillis)

val KUBERNETES_SPARK_DELETE_DRIVER_POD_ON_TERMINATION: ConfigEntry[String] =
buildConf("kyuubi.kubernetes.spark.deleteDriverPodOnTermination")
val KUBERNETES_SPARK_CLEANUP_TERMINATED_DRIVER_POD: ConfigEntry[String] =
buildConf("kyuubi.kubernetes.spark.cleanupTerminatedDriverPod")
.doc("Kyuubi server will delete the spark driver pod after " +
s"the application terminates for ${KUBERNETES_TERMINATED_APPLICATION_RETAIN_PERIOD.key}. " +
"Available options are NONE, ALL, COMPLETED and " +
"default value is None which means none of the pod will be deleted")
.version("1.8.1")
.stringConf
.createWithDefault(KubernetesDeleteDriverPodStrategy.NONE.toString)
.createWithDefault(KubernetesCleanupDriverPodStrategy.NONE.toString)

object KubernetesDeleteDriverPodStrategy extends Enumeration {
type KubernetesDeleteDriverPodStrategy = Value
object KubernetesCleanupDriverPodStrategy extends Enumeration {
type KubernetesCleanupDriverPodStrategy = Value
val NONE, ALL, COMPLETED = Value
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import io.fabric8.kubernetes.client.informers.{ResourceEventHandler, SharedIndex

import org.apache.kyuubi.{KyuubiException, Logging, Utils}
import org.apache.kyuubi.config.KyuubiConf
import org.apache.kyuubi.config.KyuubiConf.{KubernetesApplicationStateSource, KubernetesDeleteDriverPodStrategy}
import org.apache.kyuubi.config.KyuubiConf.{KubernetesApplicationStateSource, KubernetesCleanupDriverPodStrategy}
import org.apache.kyuubi.config.KyuubiConf.KubernetesApplicationStateSource.KubernetesApplicationStateSource
import org.apache.kyuubi.config.KyuubiConf.KubernetesDeleteDriverPodStrategy.{ALL, COMPLETED, NONE}
import org.apache.kyuubi.config.KyuubiConf.KubernetesCleanupDriverPodStrategy.{ALL, COMPLETED, NONE}
import org.apache.kyuubi.engine.ApplicationState.{isTerminated, ApplicationState, FAILED, FINISHED, NOT_FOUND, PENDING, RUNNING, UNKNOWN}
import org.apache.kyuubi.util.KubernetesUtils

Expand Down Expand Up @@ -108,14 +108,14 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
submitTimeout = conf.get(KyuubiConf.ENGINE_KUBERNETES_SUBMIT_TIMEOUT)
// Defer cleaning terminated application information
val retainPeriod = conf.get(KyuubiConf.KUBERNETES_TERMINATED_APPLICATION_RETAIN_PERIOD)
val deleteDriverPodStrategy = KubernetesDeleteDriverPodStrategy.withName(
conf.get(KyuubiConf.KUBERNETES_SPARK_DELETE_DRIVER_POD_ON_TERMINATION))
val cleanupDriverPodStrategy = KubernetesCleanupDriverPodStrategy.withName(
conf.get(KyuubiConf.KUBERNETES_SPARK_CLEANUP_TERMINATED_DRIVER_POD))
cleanupTerminatedAppInfoTrigger = CacheBuilder.newBuilder()
.expireAfterWrite(retainPeriod, TimeUnit.MILLISECONDS)
.removalListener((notification: RemovalNotification[String, ApplicationState]) => {
Option(appInfoStore.remove(notification.getKey)).foreach { case (kubernetesInfo, removed) =>
val appLabel = notification.getKey
val shouldDelete = deleteDriverPodStrategy match {
val shouldDelete = cleanupDriverPodStrategy match {
case NONE => false
case ALL => true
case COMPLETED => !ApplicationState.isFailed(notification.getValue)
Expand Down

0 comments on commit 4caf8b1

Please sign in to comment.