dgrove-oss commented on a change in pull request #3338: implement 
suspend/resume for KubernetesContainer
URL: 
https://github.com/apache/incubator-openwhisk/pull/3338#discussion_r170385786
 
 

 ##########
 File path: 
core/invoker/src/main/scala/whisk/core/containerpool/kubernetes/KubernetesClient.scala
 ##########
 @@ -99,43 +111,133 @@ class KubernetesClient(
   }
   protected val kubectlCmd = Seq(findKubectlCmd)
 
-  def run(name: String, image: String, args: Seq[String] = Seq.empty[String])(
-    implicit transid: TransactionId): Future[ContainerId] = {
-    runCmd(Seq("run", name, s"--image=$image") ++ args, timeouts.run)
-      .map(_ => ContainerId(name))
-  }
+  def run(name: String,
+          image: String,
+          memory: ByteSize = 256.MB,
+          environment: Map[String, String] = Map(),
+          labels: Map[String, String] = Map())(implicit transid: 
TransactionId): Future[KubernetesContainer] = {
+
+    val envVars = environment.map {
+      case (key, value) => new 
EnvVarBuilder().withName(key).withValue(value).build()
+    }.toSeq
+
+    val pod = new PodBuilder()
+      .withNewMetadata()
+      .withName(name)
+      .addToLabels("name", name)
+      .addToLabels(mapAsJavaMap(labels))
+      .endMetadata()
+      .withNewSpec()
+      .withRestartPolicy("Always")
 
 Review comment:
   Preserving the behavior that was there.  I agree we don't actually want them 
to be restarted but @bbrowning said in #3219 that on OpenShift they need to set 
the restart policy to Always as a hack to prevent the containers from being 
arbitrarily killed by the system.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to