You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2020/03/11 21:40:05 UTC

[GitHub] [openwhisk] tysonnorris opened a new pull request #4857: change the kubernetes pod wait logic to use akka after pattern

tysonnorris opened a new pull request #4857: change the kubernetes pod wait logic to use akka after pattern 
URL: https://github.com/apache/openwhisk/pull/4857
 
 
   instead of fabric8 client waitUntilReady. See discussion in #4812
   
   
   <!--- Provide a concise summary of your changes in the Title -->
   
   ## Description
   <!--- Provide a detailed description of your changes. -->
   <!--- Include details of what problem you are solving and how your changes are tested. -->
   This allows more precision for config specified at `whisk.kubernetes.timeouts.run`
   
   
   ## Related issue and scope
   <!--- Please include a link to a related issue if there is one. -->
   - [x] I opened an issue to propose and discuss this change (#4812)
   
   ## My changes affect the following components
   <!--- Select below all system components are affected by your change. -->
   <!--- Enter an `x` in all applicable boxes. -->
   - [ ] API
   - [ ] Controller
   - [ ] Message Bus (e.g., Kafka)
   - [ ] Loadbalancer
   - [x] Invoker
   - [ ] Intrinsic actions (e.g., sequences, conductors)
   - [ ] Data stores (e.g., CouchDB)
   - [ ] Tests
   - [ ] Deployment
   - [ ] CLI
   - [ ] General tooling
   - [ ] Documentation
   
   ## Types of changes
   <!--- What types of changes does your code introduce? Use `x` in all the boxes that apply: -->
   - [ ] Bug fix (generally a non-breaking change which closes an issue).
   - [x] Enhancement or new feature (adds new functionality).
   - [ ] Breaking change (a bug fix or enhancement which changes existing behavior).
   
   ## Checklist:
   <!--- Please review the points below which help you make sure you've covered all aspects of the change you're making. -->
   
   - [x] I signed an [Apache CLA](https://github.com/apache/openwhisk/blob/master/CONTRIBUTING.md).
   - [x] I reviewed the [style guides](https://github.com/apache/openwhisk/wiki/Contributing:-Git-guidelines#code-readiness) and followed the recommendations (Travis CI will check :).
   - [ ] I added tests to cover my changes.
   - [ ] My changes require further changes to the documentation.
   - [ ] I updated the documentation where necessary.
   
   

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


With regards,
Apache Git Services

[GitHub] [openwhisk] dgrove-oss commented on a change in pull request #4857: change the kubernetes pod wait logic to use akka after pattern

Posted by GitBox <gi...@apache.org>.
dgrove-oss commented on a change in pull request #4857: change the kubernetes pod wait logic to use akka after pattern 
URL: https://github.com/apache/openwhisk/pull/4857#discussion_r391601169
 
 

 ##########
 File path: core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesClient.scala
 ##########
 @@ -274,6 +275,29 @@ class KubernetesClient(
     implicit val kubernetes = this
     new KubernetesContainer(id, addr, workerIP, nativeContainerId, portFwd)
   }
+  // check for ready status every 1 second until timeout (minus the start time, which is the time for the pod create call) has past
+  private def waitForPod(namespace: String,
+                         pod: Pod,
+                         start: Instant,
+                         timeout: FiniteDuration,
+                         deadlineOpt: Option[Deadline] = None): Future[Pod] = {
+    val readyPod = kubeRestClient
+      .pods()
+      .inNamespace(namespace)
+      .withName(pod.getMetadata.getName)
+    val deadline = deadlineOpt.getOrElse((timeout - (System.currentTimeMillis() - start.toEpochMilli).millis).fromNow)
+    if (!readyPod.isReady) {
+      if (deadline.isOverdue()) {
+        Future.failed(KubernetesPodReadyTimeoutException(timeout))
+      } else {
+        after(1.seconds, scheduler) {
+          waitForPod(namespace, pod, start, timeout, Some(deadline))
 
 Review comment:
   Thanks markus.

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


With regards,
Apache Git Services

[GitHub] [openwhisk] codecov-io commented on issue #4857: change the kubernetes pod wait logic to use akka after pattern

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #4857: change the kubernetes pod wait logic to use akka after pattern 
URL: https://github.com/apache/openwhisk/pull/4857#issuecomment-597942382
 
 
   # [Codecov](https://codecov.io/gh/apache/openwhisk/pull/4857?src=pr&el=h1) Report
   > Merging [#4857](https://codecov.io/gh/apache/openwhisk/pull/4857?src=pr&el=desc) into [master](https://codecov.io/gh/apache/openwhisk/commit/90380176f5d201e77b08ee00b248ed20e6eaf099&el=desc) will **decrease** coverage by `6.22%`.
   > The diff coverage is `8.33%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/openwhisk/pull/4857/graphs/tree.svg?width=650&height=150&src=pr&token=l0YmsiSAso)](https://codecov.io/gh/apache/openwhisk/pull/4857?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #4857      +/-   ##
   ==========================================
   - Coverage   82.33%   76.10%   -6.23%     
   ==========================================
     Files         200      200              
     Lines        9283     9290       +7     
     Branches      381      380       -1     
   ==========================================
   - Hits         7643     7070     -573     
   - Misses       1640     2220     +580     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/openwhisk/pull/4857?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...re/containerpool/kubernetes/KubernetesClient.scala](https://codecov.io/gh/apache/openwhisk/pull/4857/diff?src=pr&el=tree#diff-Y29yZS9pbnZva2VyL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvY29udGFpbmVycG9vbC9rdWJlcm5ldGVzL0t1YmVybmV0ZXNDbGllbnQuc2NhbGE=) | `20.78% <8.33%> (-0.27%)` | :arrow_down: |
   | [...core/database/cosmosdb/RxObservableImplicits.scala](https://codecov.io/gh/apache/openwhisk/pull/4857/diff?src=pr&el=tree#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvZGF0YWJhc2UvY29zbW9zZGIvUnhPYnNlcnZhYmxlSW1wbGljaXRzLnNjYWxh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...ore/database/cosmosdb/cache/CacheInvalidator.scala](https://codecov.io/gh/apache/openwhisk/pull/4857/diff?src=pr&el=tree#diff-Y29yZS9jb3Ntb3NkYi9jYWNoZS1pbnZhbGlkYXRvci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL29wZW53aGlzay9jb3JlL2RhdGFiYXNlL2Nvc21vc2RiL2NhY2hlL0NhY2hlSW52YWxpZGF0b3Iuc2NhbGE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...e/database/cosmosdb/cache/ChangeFeedConsumer.scala](https://codecov.io/gh/apache/openwhisk/pull/4857/diff?src=pr&el=tree#diff-Y29yZS9jb3Ntb3NkYi9jYWNoZS1pbnZhbGlkYXRvci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL29wZW53aGlzay9jb3JlL2RhdGFiYXNlL2Nvc21vc2RiL2NhY2hlL0NoYW5nZUZlZWRDb25zdW1lci5zY2FsYQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...core/database/cosmosdb/CosmosDBArtifactStore.scala](https://codecov.io/gh/apache/openwhisk/pull/4857/diff?src=pr&el=tree#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvZGF0YWJhc2UvY29zbW9zZGIvQ29zbW9zREJBcnRpZmFjdFN0b3JlLnNjYWxh) | `0.00% <0.00%> (-96.23%)` | :arrow_down: |
   | [...sk/core/database/cosmosdb/CosmosDBViewMapper.scala](https://codecov.io/gh/apache/openwhisk/pull/4857/diff?src=pr&el=tree#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvZGF0YWJhc2UvY29zbW9zZGIvQ29zbW9zREJWaWV3TWFwcGVyLnNjYWxh) | `0.00% <0.00%> (-93.90%)` | :arrow_down: |
   | [...tabase/cosmosdb/cache/CacheInvalidatorConfig.scala](https://codecov.io/gh/apache/openwhisk/pull/4857/diff?src=pr&el=tree#diff-Y29yZS9jb3Ntb3NkYi9jYWNoZS1pbnZhbGlkYXRvci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL29wZW53aGlzay9jb3JlL2RhdGFiYXNlL2Nvc21vc2RiL2NhY2hlL0NhY2hlSW52YWxpZGF0b3JDb25maWcuc2NhbGE=) | `0.00% <0.00%> (-92.31%)` | :arrow_down: |
   | [...e/database/cosmosdb/cache/KafkaEventProducer.scala](https://codecov.io/gh/apache/openwhisk/pull/4857/diff?src=pr&el=tree#diff-Y29yZS9jb3Ntb3NkYi9jYWNoZS1pbnZhbGlkYXRvci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL29wZW53aGlzay9jb3JlL2RhdGFiYXNlL2Nvc21vc2RiL2NhY2hlL0thZmthRXZlbnRQcm9kdWNlci5zY2FsYQ==) | `0.00% <0.00%> (-77.78%)` | :arrow_down: |
   | [...enwhisk/connector/kafka/KamonMetricsReporter.scala](https://codecov.io/gh/apache/openwhisk/pull/4857/diff?src=pr&el=tree#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2Nvbm5lY3Rvci9rYWZrYS9LYW1vbk1ldHJpY3NSZXBvcnRlci5zY2FsYQ==) | `0.00% <0.00%> (-76.20%)` | :arrow_down: |
   | [...whisk/core/database/cosmosdb/CosmosDBSupport.scala](https://codecov.io/gh/apache/openwhisk/pull/4857/diff?src=pr&el=tree#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvZGF0YWJhc2UvY29zbW9zZGIvQ29zbW9zREJTdXBwb3J0LnNjYWxh) | `0.00% <0.00%> (-74.08%)` | :arrow_down: |
   | ... and [11 more](https://codecov.io/gh/apache/openwhisk/pull/4857/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/openwhisk/pull/4857?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/openwhisk/pull/4857?src=pr&el=footer). Last update [9038017...b714ae7](https://codecov.io/gh/apache/openwhisk/pull/4857?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

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


With regards,
Apache Git Services

[GitHub] [openwhisk] dgrove-oss commented on a change in pull request #4857: change the kubernetes pod wait logic to use akka after pattern

Posted by GitBox <gi...@apache.org>.
dgrove-oss commented on a change in pull request #4857: change the kubernetes pod wait logic to use akka after pattern 
URL: https://github.com/apache/openwhisk/pull/4857#discussion_r391301979
 
 

 ##########
 File path: core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesClient.scala
 ##########
 @@ -274,6 +275,29 @@ class KubernetesClient(
     implicit val kubernetes = this
     new KubernetesContainer(id, addr, workerIP, nativeContainerId, portFwd)
   }
+  // check for ready status every 1 second until timeout (minus the start time, which is the time for the pod create call) has past
+  private def waitForPod(namespace: String,
+                         pod: Pod,
+                         start: Instant,
+                         timeout: FiniteDuration,
+                         deadlineOpt: Option[Deadline] = None): Future[Pod] = {
+    val readyPod = kubeRestClient
+      .pods()
+      .inNamespace(namespace)
+      .withName(pod.getMetadata.getName)
+    val deadline = deadlineOpt.getOrElse((timeout - (System.currentTimeMillis() - start.toEpochMilli).millis).fromNow)
+    if (!readyPod.isReady) {
+      if (deadline.isOverdue()) {
+        Future.failed(KubernetesPodReadyTimeoutException(timeout))
+      } else {
+        after(1.seconds, scheduler) {
+          waitForPod(namespace, pod, start, timeout, Some(deadline))
 
 Review comment:
   Is Scala smart enough to convert tail calls into loops, or is there a risk of blowing the stack here with a long sequence of recursive calls?

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


With regards,
Apache Git Services

[GitHub] [openwhisk] markusthoemmes commented on a change in pull request #4857: change the kubernetes pod wait logic to use akka after pattern

Posted by GitBox <gi...@apache.org>.
markusthoemmes commented on a change in pull request #4857: change the kubernetes pod wait logic to use akka after pattern 
URL: https://github.com/apache/openwhisk/pull/4857#discussion_r391438269
 
 

 ##########
 File path: core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesClient.scala
 ##########
 @@ -274,6 +275,29 @@ class KubernetesClient(
     implicit val kubernetes = this
     new KubernetesContainer(id, addr, workerIP, nativeContainerId, portFwd)
   }
+  // check for ready status every 1 second until timeout (minus the start time, which is the time for the pod create call) has past
+  private def waitForPod(namespace: String,
+                         pod: Pod,
+                         start: Instant,
+                         timeout: FiniteDuration,
+                         deadlineOpt: Option[Deadline] = None): Future[Pod] = {
+    val readyPod = kubeRestClient
+      .pods()
+      .inNamespace(namespace)
+      .withName(pod.getMetadata.getName)
+    val deadline = deadlineOpt.getOrElse((timeout - (System.currentTimeMillis() - start.toEpochMilli).millis).fromNow)
+    if (!readyPod.isReady) {
+      if (deadline.isOverdue()) {
+        Future.failed(KubernetesPodReadyTimeoutException(timeout))
+      } else {
+        after(1.seconds, scheduler) {
+          waitForPod(namespace, pod, start, timeout, Some(deadline))
 
 Review comment:
   It's not a recursive call in this case. It's trampolined via the execution context as this is only eventually executed.

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


With regards,
Apache Git Services

[GitHub] [openwhisk] tysonnorris merged pull request #4857: change the kubernetes pod wait logic to use akka after pattern

Posted by GitBox <gi...@apache.org>.
tysonnorris merged pull request #4857: change the kubernetes pod wait logic to use akka after pattern 
URL: https://github.com/apache/openwhisk/pull/4857
 
 
   

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


With regards,
Apache Git Services