From 4caf8b152756f20cb7fd09564a937c91f006be5f Mon Sep 17 00:00:00 2001 From: yeatsliao Date: Mon, 20 Nov 2023 14:29:49 +0800 Subject: [PATCH] rename conf 'KUBERNETES_SPARK_DELETE_DRIVER_POD_ON_TERMINATION' to 'KUBERNETES_SPARK_CLEANUP_TERMINATED_DRIVER_POD' --- .../scala/org/apache/kyuubi/config/KyuubiConf.scala | 10 +++++----- .../kyuubi/engine/KubernetesApplicationOperation.scala | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala index 8a7ef5b7af6..2bc27b20c5f 100644 --- a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala +++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala @@ -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 } diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala index a185ca1fc81..c8828f5d83c 100644 --- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala +++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala @@ -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 @@ -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)