Make runtime delete timeout configurable (#5028)

Co-authored-by: ning.yougang <ning.yougang@navercorp.com>
diff --git a/core/invoker/src/main/resources/application.conf b/core/invoker/src/main/resources/application.conf
index 8ddb68d..be68333 100644
--- a/core/invoker/src/main/resources/application.conf
+++ b/core/invoker/src/main/resources/application.conf
@@ -173,4 +173,5 @@
   invoker {
     protocol: http
   }
+  runtime.delete.timeout = "30 seconds"
 }
diff --git a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesContainerFactory.scala b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesContainerFactory.scala
index a73cb0d..8292eba 100644
--- a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesContainerFactory.scala
+++ b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesContainerFactory.scala
@@ -64,7 +64,7 @@
     logging.info(this, "Cleaning up function runtimes")
     val labels = Map("invoker" -> label, "release" -> KubernetesContainerFactoryProvider.release)
     val cleaning = kubernetes.rm(labels, true)(TransactionId.invokerNanny)
-    Await.ready(cleaning, 30.seconds)
+    Await.ready(cleaning, KubernetesContainerFactoryProvider.runtimeDeleteTimeout)
   }
 
   override def createContainer(tid: TransactionId,
@@ -90,6 +90,7 @@
 object KubernetesContainerFactoryProvider extends ContainerFactoryProvider {
 
   val release = loadConfigOrThrow[String]("whisk.helm.release")
+  val runtimeDeleteTimeout = loadConfigOrThrow[FiniteDuration]("whisk.runtime.delete.timeout")
 
   override def instance(actorSystem: ActorSystem,
                         logging: Logging,
diff --git a/core/standalone/src/main/resources/standalone-kcf.conf b/core/standalone/src/main/resources/standalone-kcf.conf
index 5ab38b1..9194d80 100644
--- a/core/standalone/src/main/resources/standalone-kcf.conf
+++ b/core/standalone/src/main/resources/standalone-kcf.conf
@@ -34,4 +34,5 @@
     port-forwarding-enabled = true
   }
   helm.release = "release"
+  runtime.delete.timeout = "30 seconds"
 }
diff --git a/tests/src/test/resources/application.conf.j2 b/tests/src/test/resources/application.conf.j2
index e2eaa0f..53d1cc9 100644
--- a/tests/src/test/resources/application.conf.j2
+++ b/tests/src/test/resources/application.conf.j2
@@ -103,6 +103,7 @@
     }
 
     helm.release = "release"
+    runtime.delete.timeout = "30 seconds"
 }
 
 #test-only overrides so that tests can override defaults in application.conf (todo: move all defaults to reference.conf)