Skip to content

Commit 1a8364d

Browse files
authored
Upgrade the Kubernetes client version. (#5275)
1 parent 7c5a5d6 commit 1a8364d

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesClient.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ class KubernetesClient(
194194
case e =>
195195
transid.failed(this, start, s"Failed create pod for '$name': ${e.getClass} - ${e.getMessage}", ErrorLevel)
196196
//log pod events to diagnose pod readiness failures
197-
val podEvents = kubeRestClient.events
197+
val podEvents = kubeRestClient
198+
.v1()
199+
.events()
198200
.inNamespace(namespace)
199201
.withField("involvedObject.name", name)
200202
.list()

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ gradle.ext.akka_http = [version : '10.2.4']
6767
gradle.ext.akka_management = [version : '1.0.5']
6868

6969
gradle.ext.curator = [version : '4.0.0']
70-
gradle.ext.kube_client = [version: '4.4.2']
70+
gradle.ext.kube_client = [version: '4.10.3']

tests/src/test/scala/org/apache/openwhisk/core/containerpool/kubernetes/test/WhiskPodBuilderTests.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,21 @@ class WhiskPodBuilderTests extends FlatSpec with Matchers with KubeClientSupport
8888
withClue(Serialization.asYaml(pod)) {
8989
val c = getActionContainer(pod)
9090
//min cpu is: config.millicpus
91-
c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe Some("300m")
91+
c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe Some("300")
9292
}
9393

9494
val (pod2, _) = builder.buildPodSpec(name, testImage, 15.MB, Map("foo" -> "bar"), Map("fooL" -> "barV"), config)
9595
withClue(Serialization.asYaml(pod2)) {
9696
val c = getActionContainer(pod2)
9797
//max cpu is: config.maxMillicpus
98-
c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe Some("1000m")
98+
c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe Some("1000")
9999
}
100100

101101
val (pod3, _) = builder.buildPodSpec(name, testImage, 7.MB, Map("foo" -> "bar"), Map("fooL" -> "barV"), config)
102102
withClue(Serialization.asYaml(pod3)) {
103103
val c = getActionContainer(pod3)
104104
//scaled cpu is: action mem/config.mem x config.maxMillicpus
105-
c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe Some("600m")
105+
c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe Some("600")
106106
}
107107

108108
val config2 = KubernetesClientConfig(
@@ -139,8 +139,8 @@ class WhiskPodBuilderTests extends FlatSpec with Matchers with KubeClientSupport
139139
val (pod, _) = builder.buildPodSpec(name, testImage, 2.MB, Map("foo" -> "bar"), Map("fooL" -> "barV"), config)
140140
withClue(Serialization.asYaml(pod)) {
141141
val c = getActionContainer(pod)
142-
c.getResources.getLimits.asScala.get("ephemeral-storage").map(_.getAmount) shouldBe Some("1024Mi")
143-
c.getResources.getRequests.asScala.get("ephemeral-storage").map(_.getAmount) shouldBe Some("1024Mi")
142+
c.getResources.getLimits.asScala.get("ephemeral-storage").map(_.getAmount) shouldBe Some("1024")
143+
c.getResources.getRequests.asScala.get("ephemeral-storage").map(_.getAmount) shouldBe Some("1024")
144144
}
145145
}
146146

@@ -222,8 +222,8 @@ class WhiskPodBuilderTests extends FlatSpec with Matchers with KubeClientSupport
222222
new EnvVar("foo", "bar", null),
223223
new EnvVar("POD_UID", null, new EnvVarSource(null, new ObjectFieldSelector(null, "metadata.uid"), null, null))))
224224

225-
c.getResources.getLimits.asScala.get("memory").map(_.getAmount) shouldBe Some("10Mi")
226-
c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe Some("900m")
225+
c.getResources.getLimits.asScala.get("memory").map(_.getAmount) shouldBe Some("10")
226+
c.getResources.getLimits.asScala.get("cpu").map(_.getAmount) shouldBe Some("900")
227227
c.getSecurityContext.getCapabilities.getDrop.asScala should contain allOf ("NET_RAW", "NET_ADMIN")
228228
c.getPorts.asScala.find(_.getName == "action").map(_.getContainerPort) shouldBe Some(8080)
229229
c.getImage shouldBe testImage

0 commit comments

Comments
 (0)