This is an automated email from the ASF dual-hosted git repository.

style95 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a8364dcb Upgrade the Kubernetes client version. (#5275)
1a8364dcb is described below

commit 1a8364dcb7e1b24cb79e463a9f54d82cefad832f
Author: Dominic Kim <[email protected]>
AuthorDate: Fri Jul 15 14:28:22 2022 +0900

    Upgrade the Kubernetes client version. (#5275)
---
 .../core/containerpool/kubernetes/KubernetesClient.scala   |  4 +++-
 settings.gradle                                            |  2 +-
 .../kubernetes/test/WhiskPodBuilderTests.scala             | 14 +++++++-------
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git 
a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesClient.scala
 
b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesClient.scala
index ce5a6559b..ccfcf5c4a 100644
--- 
a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesClient.scala
+++ 
b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesClient.scala
@@ -194,7 +194,9 @@ class KubernetesClient(
             case e =>
               transid.failed(this, start, s"Failed create pod for '$name': 
${e.getClass} - ${e.getMessage}", ErrorLevel)
               //log pod events to diagnose pod readiness failures
-              val podEvents = kubeRestClient.events
+              val podEvents = kubeRestClient
+                .v1()
+                .events()
                 .inNamespace(namespace)
                 .withField("involvedObject.name", name)
                 .list()
diff --git a/settings.gradle b/settings.gradle
index 861f00a1a..430b2b9b5 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -67,4 +67,4 @@ gradle.ext.akka_http = [version : '10.2.4']
 gradle.ext.akka_management = [version : '1.0.5']
 
 gradle.ext.curator = [version : '4.0.0']
-gradle.ext.kube_client = [version: '4.4.2']
+gradle.ext.kube_client = [version: '4.10.3']
diff --git 
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/kubernetes/test/WhiskPodBuilderTests.scala
 
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/kubernetes/test/WhiskPodBuilderTests.scala
index 93bc4b3cf..07bb3ad7d 100644
--- 
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/kubernetes/test/WhiskPodBuilderTests.scala
+++ 
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/kubernetes/test/WhiskPodBuilderTests.scala
@@ -88,21 +88,21 @@ class WhiskPodBuilderTests extends FlatSpec with Matchers 
with KubeClientSupport
     withClue(Serialization.asYaml(pod)) {
       val c = getActionContainer(pod)
       //min cpu is: config.millicpus
-      c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe 
Some("300m")
+      c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe 
Some("300")
     }
 
     val (pod2, _) = builder.buildPodSpec(name, testImage, 15.MB, Map("foo" -> 
"bar"), Map("fooL" -> "barV"), config)
     withClue(Serialization.asYaml(pod2)) {
       val c = getActionContainer(pod2)
       //max cpu is: config.maxMillicpus
-      c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe 
Some("1000m")
+      c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe 
Some("1000")
     }
 
     val (pod3, _) = builder.buildPodSpec(name, testImage, 7.MB, Map("foo" -> 
"bar"), Map("fooL" -> "barV"), config)
     withClue(Serialization.asYaml(pod3)) {
       val c = getActionContainer(pod3)
       //scaled cpu is: action mem/config.mem x config.maxMillicpus
-      c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe 
Some("600m")
+      c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe 
Some("600")
     }
 
     val config2 = KubernetesClientConfig(
@@ -139,8 +139,8 @@ class WhiskPodBuilderTests extends FlatSpec with Matchers 
with KubeClientSupport
     val (pod, _) = builder.buildPodSpec(name, testImage, 2.MB, Map("foo" -> 
"bar"), Map("fooL" -> "barV"), config)
     withClue(Serialization.asYaml(pod)) {
       val c = getActionContainer(pod)
-      
c.getResources.getLimits.asScala.get("ephemeral-storage").map(_.getAmount) 
shouldBe Some("1024Mi")
-      
c.getResources.getRequests.asScala.get("ephemeral-storage").map(_.getAmount) 
shouldBe Some("1024Mi")
+      
c.getResources.getLimits.asScala.get("ephemeral-storage").map(_.getAmount) 
shouldBe Some("1024")
+      
c.getResources.getRequests.asScala.get("ephemeral-storage").map(_.getAmount) 
shouldBe Some("1024")
     }
   }
 
@@ -222,8 +222,8 @@ class WhiskPodBuilderTests extends FlatSpec with Matchers 
with KubeClientSupport
         new EnvVar("foo", "bar", null),
         new EnvVar("POD_UID", null, new EnvVarSource(null, new 
ObjectFieldSelector(null, "metadata.uid"), null, null))))
 
-      c.getResources.getLimits.asScala.get("memory").map(_.getAmount) shouldBe 
Some("10Mi")
-      c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe 
Some("900m")
+      c.getResources.getLimits.asScala.get("memory").map(_.getAmount) shouldBe 
Some("10")
+      c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe 
Some("900")
       c.getSecurityContext.getCapabilities.getDrop.asScala should contain 
allOf ("NET_RAW", "NET_ADMIN")
       c.getPorts.asScala.find(_.getName == "action").map(_.getContainerPort) 
shouldBe Some(8080)
       c.getImage shouldBe testImage

Reply via email to