[GitHub] upgle commented on issue #3265: Change recently added metric key name. (very simple change)

2018-02-23 Thread GitBox
upgle commented on issue #3265: Change recently added metric key name. (very 
simple change)
URL: 
https://github.com/apache/incubator-openwhisk/pull/3265#issuecomment-368209072
 
 
   I will close this PR because these metrics removed from #3284 PR.
   


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


[GitHub] upgle closed pull request #3265: Change recently added metric key name. (very simple change)

2018-02-23 Thread GitBox
upgle closed pull request #3265: Change recently added metric key name. (very 
simple change)
URL: https://github.com/apache/incubator-openwhisk/pull/3265
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/common/scala/src/main/scala/whisk/common/Logging.scala 
b/common/scala/src/main/scala/whisk/common/Logging.scala
index e681eb5389..a67a8fb340 100644
--- a/common/scala/src/main/scala/whisk/common/Logging.scala
+++ b/common/scala/src/main/scala/whisk/common/Logging.scala
@@ -243,7 +243,7 @@ object LoggingMarkers {
   val LOADBALANCER_INVOKER_OFFLINE = LogMarkerToken(loadbalancer, 
"invokerOffline", count)
   val LOADBALANCER_INVOKER_UNHEALTHY = LogMarkerToken(loadbalancer, 
"invokerUnhealthy", count)
   def LOADBALANCER_ACTIVATION_START(namespaceId: String) =
-LogMarkerToken(loadbalancer, s"activations_$namespaceId", count)
+LogMarkerToken(loadbalancer, s"activations.$namespaceId", count)
 
   // Time that is needed to execute the action
   val INVOKER_ACTIVATION_RUN = LogMarkerToken(invoker, "activationRun", start)
@@ -259,7 +259,7 @@ object LoggingMarkers {
   def INVOKER_DOCKER_CMD(cmd: String) = LogMarkerToken(invoker, 
s"docker.$cmd", start)
   def INVOKER_RUNC_CMD(cmd: String) = LogMarkerToken(invoker, s"runc.$cmd", 
start)
   def INVOKER_CONTAINER_START(actionName: String, namespaceName: String, 
containerState: String) =
-LogMarkerToken(invoker, 
s"container_start_${containerState}_${namespaceName}_$actionName", count)
+LogMarkerToken(invoker, 
s"containerStart.$containerState.$namespaceName.$actionName", count)
 
   /*
* General markers


 


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


[GitHub] upgle opened a new pull request #3343: Support time-series DB using Kamon Tag, and optional granular metric.

2018-02-23 Thread GitBox
upgle opened a new pull request #3343: Support time-series DB using Kamon Tag, 
and optional granular metric.
URL: https://github.com/apache/incubator-openwhisk/pull/3343
 
 
   This PR is for supporting time-series database using Kamon Tag like 
OpenTSDB, Datadog.
   and also added **optional** granular metric. (this metric was removed by 
#3284 PR)
   (We need this feature for tracking activities per namespace, and already 
have built up enough infrastructure)
   
   ### Reference
   
   http://opentsdb.net/docs/build/html/user_guide/writing.html
   > OpenTSDB handles things a bit differently by introducing the idea of 
'tags'. Each time series still has a 'metric' name, but it's much more generic, 
something that can be shared by many unique time series. Instead, the 
uniqueness comes from a combination of tag key/value pairs that allows for 
flexible queries with very fast aggregations.
   
   https://docs.datadoghq.com/agent/tagging/
   > Tagging is used throughout the Datadog product to make it easier to subset 
and query the machines and metrics that you have to monitor.
   
   
   
   ## Preview
   _* It is tested on both OpenTSDB and Graphite_
   
   ### 1. OpenTSDB (Tag based)
   In OpenTSDB, you can use regexable aggregation query with tag only.
   
   
![image](https://user-images.githubusercontent.com/5635513/36626477-df89140e-1976-11e8-86a5-9895f1b9e8cb.png)
   
   ### 2. Graphite (Metric name based)
   In Graphite, you can use regexable aggregation query with a metric name only.
   
   
![image](https://user-images.githubusercontent.com/5635513/36626575-995ac0f2-1978-11e8-9ed7-d49252ce5a5a.png)
   
   
![image](https://user-images.githubusercontent.com/5635513/36626581-aad87cfc-1978-11e8-8590-2ec0e1bc2dc3.png)
   


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


[GitHub] rabbah closed issue #3321: __ow_body should always be a string (or null?)

2018-02-23 Thread GitBox
rabbah closed issue #3321: __ow_body should always be a string (or null?)
URL: https://github.com/apache/incubator-openwhisk/issues/3321
 
 
   


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


[GitHub] csantanapr closed pull request #3318: Remove restriction on updating a trigger with a new feed.

2018-02-23 Thread GitBox
csantanapr closed pull request #3318: Remove restriction on updating a trigger 
with a new feed.
URL: https://github.com/apache/incubator-openwhisk/pull/3318
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/core/controller/src/main/scala/whisk/core/controller/Triggers.scala 
b/core/controller/src/main/scala/whisk/core/controller/Triggers.scala
index 8302d74db6..7a2428675f 100644
--- a/core/controller/src/main/scala/whisk/core/controller/Triggers.scala
+++ b/core/controller/src/main/scala/whisk/core/controller/Triggers.scala
@@ -245,15 +245,7 @@ trait WhiskTriggersApi extends WhiskCollectionAPI {
   content.publish getOrElse trigger.publish,
   content.annotations getOrElse trigger.annotations,
   trigger.rules).revision[WhiskTrigger](trigger.docinfo.rev)
-
-// feed must be specified in create, and cannot be added as a trigger 
update
-content.annotations flatMap { _.get(Parameters.Feed) } map { _ =>
-  Future failed {
-RejectRequest(BadRequest, "A trigger feed is only permitted when the 
trigger is created")
-  }
-} getOrElse {
-  Future successful newTrigger
-}
+Future.successful(newTrigger)
   }
 
   /**
diff --git 
a/tests/src/test/scala/whisk/core/controller/test/TriggersApiTests.scala 
b/tests/src/test/scala/whisk/core/controller/test/TriggersApiTests.scala
index fdfcf4f71b..44ab26b92a 100644
--- a/tests/src/test/scala/whisk/core/controller/test/TriggersApiTests.scala
+++ b/tests/src/test/scala/whisk/core/controller/test/TriggersApiTests.scala
@@ -303,7 +303,8 @@ class TriggersApiTests extends ControllerTestCommon with 
WhiskTriggersApi {
 val content = WhiskTriggerPut(annotations = Some(trigger.annotations))
 put(entityStore, trigger)
 Put(s"$collectionPath/${trigger.name}?overwrite=true", content) ~> 
Route.seal(routes(creds)) ~> check {
-  status should be(BadRequest)
+  deleteTrigger(trigger.docid)
+  status should be(OK)
 }
   }
 
@@ -313,7 +314,8 @@ class TriggersApiTests extends ControllerTestCommon with 
WhiskTriggersApi {
 val content = WhiskTriggerPut(annotations = 
Some(Parameters(Parameters.Feed, "xyz")))
 put(entityStore, trigger)
 Put(s"$collectionPath/${trigger.name}?overwrite=true", content) ~> 
Route.seal(routes(creds)) ~> check {
-  status should be(BadRequest)
+  deleteTrigger(trigger.docid)
+  status should be(OK)
 }
   }
 


 


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


[GitHub] csantanapr closed issue #3297: Allow adding a feed on trigger update.

2018-02-23 Thread GitBox
csantanapr closed issue #3297: Allow adding a feed on trigger update.
URL: https://github.com/apache/incubator-openwhisk/issues/3297
 
 
   


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


[GitHub] csantanapr closed pull request #3333: Make parameters with defined values final

2018-02-23 Thread GitBox
csantanapr closed pull request #: Make parameters with defined values final 
URL: https://github.com/apache/incubator-openwhisk/pull/
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/common/scala/src/main/scala/whisk/core/entity/Parameter.scala 
b/common/scala/src/main/scala/whisk/core/entity/Parameter.scala
index 0dd6518584..18ddb6ea7d 100644
--- a/common/scala/src/main/scala/whisk/core/entity/Parameter.scala
+++ b/common/scala/src/main/scala/whisk/core/entity/Parameter.scala
@@ -41,10 +41,7 @@ protected[core] class Parameters protected[entity] (private 
val params: Map[Para
*/
   def size = {
 params
-  .map {
-case (name, value) =>
-  name.size + value.size
-  }
+  .map { case (name, value) => name.size + value.size }
   .foldLeft(0 B)(_ + _)
   }
 
@@ -77,14 +74,14 @@ protected[core] class Parameters protected[entity] (private 
val params: Map[Para
 params.keySet filter (params(_).isDefined) map (_.name)
   }
 
-  protected[core] def toJsArray =
+  protected[core] def toJsArray = {
 JsArray(params map { p =>
   JsObject("key" -> p._1.name.toJson, "value" -> p._2.value.toJson)
 } toSeq: _*)
-  protected[core] def toJsObject =
-JsObject(params map { p =>
-  (p._1.name -> p._2.value.toJson)
-})
+  }
+
+  protected[core] def toJsObject = JsObject(params.map(p => (p._1.name -> 
p._2.value.toJson)))
+
   override def toString = toJsArray.compactPrint
 
   /**
diff --git a/core/controller/src/main/scala/whisk/core/controller/Actions.scala 
b/core/controller/src/main/scala/whisk/core/controller/Actions.scala
index 1e26a6684c..1fb47c02ff 100644
--- a/core/controller/src/main/scala/whisk/core/controller/Actions.scala
+++ b/core/controller/src/main/scala/whisk/core/controller/Actions.scala
@@ -226,38 +226,17 @@ trait WhiskActionsApi extends WhiskCollectionAPI with 
PostActionActivation with
 onComplete(entitleReferencedEntitiesMetaData(user, 
Privilege.ACTIVATE, Some(action.exec))) {
   case Success(_) =>
 val actionWithMergedParams = env.map(action.inherit(_)) 
getOrElse action
-val waitForResponse = if (blocking) Some(waitOverride) else 
None
-onComplete(invokeAction(user, actionWithMergedParams, payload, 
waitForResponse, cause = None)) {
-  case Success(Left(activationId)) =>
-// non-blocking invoke or blocking invoke which got queued 
instead
-complete(Accepted, activationId.toJsObject)
-  case Success(Right(activation)) =>
-val response = if (result) activation.resultAsJson else 
activation.toExtendedJson
-
-if (activation.response.isSuccess) {
-  complete(OK, response)
-} else if (activation.response.isApplicationError) {
-  // actions that result is ApplicationError status are 
considered a 'success'
-  // and will have an 'error' property in the result - the 
HTTP status is OK
-  // and clients must check the response status if it 
exists
-  // NOTE: response status will not exist in the JSON 
object if ?result == true
-  // and instead clients must check if 'error' is in the 
JSON
-  // PRESERVING OLD BEHAVIOR and will address defect in 
separate change
-  complete(BadGateway, response)
-} else if (activation.response.isContainerError) {
-  complete(BadGateway, response)
-} else {
-  complete(InternalServerError, response)
-}
-  case Failure(t: RecordTooLargeException) =>
-logging.debug(this, s"[POST] action payload was too large")
-terminate(RequestEntityTooLarge)
-  case Failure(RejectRequest(code, message)) =>
-logging.debug(this, s"[POST] action rejected with code 
$code: $message")
-terminate(code, message)
-  case Failure(t: Throwable) =>
-logging.error(this, s"[POST] action activation failed: 
${t.getMessage}")
-terminate(InternalServerError)
+
+// incoming parameters may not override final parameters 
(i.e., parameters with already defined values)
+// on an action once its parameters are resolved across 
package and binding
+val allowInvoke = payload
+  .map(_.fields.keySet.forall(key => 
!actionWithMergedParams.immutableParameters.contains(key)))
+  .getOrElse(true)
+
+

[GitHub] csantanapr closed pull request #3341: Remove view supporting now removed API for listing assets in namespace.

2018-02-23 Thread GitBox
csantanapr closed pull request #3341: Remove view supporting now removed API 
for listing assets in namespace.
URL: https://github.com/apache/incubator-openwhisk/pull/3341
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/ansible/files/whisks_design_document_for_all_entities_db_v2.1.0.json 
b/ansible/files/whisks_design_document_for_all_entities_db_v2.1.0.json
deleted file mode 100644
index ae8f475f93..00
--- a/ansible/files/whisks_design_document_for_all_entities_db_v2.1.0.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-  "_id": "_design/all-whisks.v2.1.0",
-  "language": "javascript",
-  "views": {
-"all": {
-  "map": "function (doc) {\n  var PATHSEP = \"/\";\n\n  var isPackage = 
function (doc) {  return (doc.binding !== undefined) };\n  var isAction = 
function (doc) { return (doc.exec !== undefined) };\n  var isTrigger = function 
(doc) { return (doc.exec === undefined && doc.binding === undefined && 
doc.parameters !== undefined) };\n  var isRule = function (doc) {  return 
(doc.trigger !== undefined) };\n  \n  var collection = function (doc) {\nif 
(isPackage(doc)) return \"packages\";\nif (isAction(doc)) return 
\"actions\";\nif (isTrigger(doc)) return \"triggers\";\nif 
(isRule(doc)) return \"rules\";\nreturn undefined;\n  };\n\n  try {\n
var type = collection(doc);\nif (type !== undefined) {\n  var ns = 
doc.namespace.split(PATHSEP);\n  var root = ns[0];\n  var value = {\n   
 collection: type,\nnamespace: doc.namespace,\nname: 
doc.name,\nversion: doc.version,\npublish: doc.publish,\n   
 annotations: doc.annotations,\nupdated: doc.updated\n  };\n  
if (isAction(doc)) {\nvalue.limits = doc.limits;\nvalue.exec = 
{ binary: doc.exec.binary || false};\n  } else if (isPackage(doc)) {\n  
  if (Object.keys(doc.binding).length > 0) {\n  value.binding = 
doc.binding;\n} else {\n  value.binding = false;\n}\n   
   }\n  emit([root, doc.updated], value);\n}\n  } catch (e) {}\n}",
-  "reduce": "_count"
-}
-  }
-}
\ No newline at end of file
diff --git a/ansible/tasks/recreateViews.yml b/ansible/tasks/recreateViews.yml
index 7868f85437..d237da7974 100644
--- a/ansible/tasks/recreateViews.yml
+++ b/ansible/tasks/recreateViews.yml
@@ -7,7 +7,6 @@
 doc: "{{ lookup('file', '{{ item }}') }}"
   with_items:
 - "{{ openwhisk_home 
}}/ansible/files/whisks_design_document_for_entities_db_v2.1.0.json"
-- "{{ openwhisk_home 
}}/ansible/files/whisks_design_document_for_all_entities_db_v2.1.0.json"
 - "{{ openwhisk_home }}/ansible/files/filter_design_document.json"
 
 - include: db/recreateDoc.yml


 


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


[GitHub] csantanapr closed pull request #3323: Normalize a missing body for raw actions to JsString.empty.

2018-02-23 Thread GitBox
csantanapr closed pull request #3323: Normalize a missing body for raw actions 
to JsString.empty.
URL: https://github.com/apache/incubator-openwhisk/pull/3323
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/core/controller/src/main/scala/whisk/core/controller/WebActions.scala 
b/core/controller/src/main/scala/whisk/core/controller/WebActions.scala
index cd3c68ca37..0bb6b779fb 100644
--- a/core/controller/src/main/scala/whisk/core/controller/WebActions.scala
+++ b/core/controller/src/main/scala/whisk/core/controller/WebActions.scala
@@ -129,11 +129,11 @@ private case class Context(propertyMap: WebApiDirectives,
 // if the body is a json object, merge with query parameters
 // otherwise, this is an opaque body that will be nested under
 // __ow_body in the parameters sent to the action as an argument
-val bodyParams = body match {
+val bodyParams: Map[String, JsValue] = body match {
   case Some(JsObject(fields)) if !boxQueryAndBody => fields
   case Some(v)=> Map(propertyMap.body 
-> v)
   case None if !boxQueryAndBody   => Map.empty
-  case _  => Map(propertyMap.body 
-> JsObject())
+  case _  => Map(propertyMap.body 
-> JsString.empty)
 }
 
 // precedence order is: query params -> body (last wins)
diff --git 
a/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala 
b/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala
index 2bcfe9122f..2f47595925 100644
--- a/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala
+++ b/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala
@@ -1536,7 +1536,7 @@ trait WebActionsApiBaseTests extends ControllerTestCommon 
with BeforeAndAfterEac
   "action" -> "raw_export_c".toJson,
   "content" -> metaPayload(
 Post.method.name.toLowerCase,
-Map(webApiDirectives.body -> JsObject(), webApiDirectives.query -> 
queryString.toJson).toJson.asJsObject,
+Map(webApiDirectives.body -> "".toJson, webApiDirectives.query -> 
queryString.toJson).toJson.asJsObject,
 creds,
 pkgName = "proxy"))
   }
@@ -1589,6 +1589,24 @@ trait WebActionsApiBaseTests extends 
ControllerTestCommon with BeforeAndAfterEac
   }
 }
 
+it should s"invoke raw action ensuring body and query arguments are empty 
strings when not specified in request (auth? ${creds.isDefined})" in {
+  implicit val tid = transid()
+
+  Post(s"$testRoutePath/$systemId/proxy/raw_export_c.json") ~> 
Route.seal(routes(creds)) ~> check {
+status should be(OK)
+invocationsAllowed += 1
+val response = responseAs[JsObject]
+response shouldBe JsObject(
+  "pkg" -> s"$systemId/proxy".toJson,
+  "action" -> "raw_export_c".toJson,
+  "content" -> metaPayload(
+Post.method.name.toLowerCase,
+Map(webApiDirectives.body -> "".toJson, webApiDirectives.query -> 
"".toJson).toJson.asJsObject,
+creds,
+pkgName = "proxy"))
+  }
+}
+
 it should s"reject invocation of web action with invalid accept header 
(auth? ${creds.isDefined})" in {
   implicit val tid = transid()
 


 


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


[GitHub] csantanapr commented on issue #3334: Cli ansible fix

2018-02-23 Thread GitBox
csantanapr commented on issue #3334: Cli ansible fix
URL: 
https://github.com/apache/incubator-openwhisk/pull/3334#issuecomment-368200559
 
 
   PG2 2858 ? 


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


[GitHub] dgrove-oss commented on issue #3338: implement suspend/resume for KubernetesContainer

2018-02-23 Thread GitBox
dgrove-oss commented on issue #3338: implement suspend/resume for 
KubernetesContainer
URL: 
https://github.com/apache/incubator-openwhisk/pull/3338#issuecomment-368196944
 
 
   PG3 / 1913 ? 


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


[GitHub] rabbah commented on issue #3335: Allow container tests to run without a proxy.

2018-02-23 Thread GitBox
rabbah commented on issue #3335: Allow container tests to run without a proxy.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3335#issuecomment-368192234
 
 
   pg5/115 ? 


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


[GitHub] rabbah commented on issue #3323: Normalize a missing body for raw actions to JsString.empty.

2018-02-23 Thread GitBox
rabbah commented on issue #3323: Normalize a missing body for raw actions to 
JsString.empty.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3323#issuecomment-368192195
 
 
   pg3/1912 ? 


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


[GitHub] rabbah commented on issue #3341: Remove view supporting now removed API for listing assets in namespace.

2018-02-23 Thread GitBox
rabbah commented on issue #3341: Remove view supporting now removed API for 
listing assets in namespace.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3341#issuecomment-368192119
 
 
   pg2/2856 ? 


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


[GitHub] pritidesai opened a new pull request #754: Adding support for default package

2018-02-23 Thread GitBox
pritidesai opened a new pull request #754: Adding support for default package
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/754
 
 
   Closes #681 


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


[GitHub] kameshsampath commented on issue #97: Added maven archetype for Java Action

2018-02-23 Thread GitBox
kameshsampath commented on issue #97: Added maven archetype for Java Action
URL: 
https://github.com/apache/incubator-openwhisk-devtools/pull/97#issuecomment-368184984
 
 
   my basd to miss `--main` in the README.md, updateed now @ddragosd  


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


[GitHub] dgrove-oss commented on issue #3338: implement suspend/resume for KubernetesContainer

2018-02-23 Thread GitBox
dgrove-oss commented on issue #3338: implement suspend/resume for 
KubernetesContainer
URL: 
https://github.com/apache/incubator-openwhisk/pull/3338#issuecomment-368184519
 
 
   PG3 / 1913 ? 


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


[GitHub] mptap commented on issue #3168: Rate limit requests to download CLI, Docker and iOS SDKs

2018-02-23 Thread GitBox
mptap commented on issue #3168: Rate limit requests to download CLI, Docker and 
iOS SDKs
URL: 
https://github.com/apache/incubator-openwhisk/issues/3168#issuecomment-368183667
 
 
   @dubeejw: Please could you review? 
https://github.com/apache/incubator-openwhisk/pull/3342 Assumed key = 
$binary_remote_addr, zone = 10MB, rate = 10 reqs/sec and burst = 20 as in the 
example docs. Let me know if you want me to use other values.


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


[GitHub] mptap opened a new pull request #3342: #3168 Rate limit requests to download CLI, Docker and iOS SDKs

2018-02-23 Thread GitBox
mptap opened a new pull request #3342:  #3168 Rate limit requests to download 
CLI, Docker and iOS SDKs
URL: https://github.com/apache/incubator-openwhisk/pull/3342
 
 
   Nginx configured so that requests to download the CLI, Docker and iOS SDKs 
are rate limited.
   
   


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


[GitHub] csantanapr closed pull request #3314: Configure Gradle build scan plugin

2018-02-23 Thread GitBox
csantanapr closed pull request #3314: Configure Gradle build scan plugin
URL: https://github.com/apache/incubator-openwhisk/pull/3314
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/build.gradle b/build.gradle
index e53f40f035..b91005e8e3 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,6 +7,16 @@ buildscript {
 }
 }
 
+plugins {
+id "com.gradle.build-scan" version "1.12.1"
+}
+
+buildScan {
+termsOfServiceUrl = 'https://gradle.com/terms-of-service'
+termsOfServiceAgree = 'yes'
+publishAlwaysIf(System.getenv('CI') != null)
+}
+
 subprojects {
 apply plugin: 'scalafmt'
 scalafmt.configFilePath = gradle.scalafmt.config
diff --git a/tools/build/README.md b/tools/build/README.md
index 0c369cb2b2..29a2121222 100644
--- a/tools/build/README.md
+++ b/tools/build/README.md
@@ -68,6 +68,19 @@ The logs are saved to `./B-build.log` and can be reprocessed 
using `citool` with
 citool -i -b B cat -s -g "tid_124" whisk/logs N
 ```
 
+## Gradle Build Scan Integration
+
+OpenWhisk builds on CI setups have [Gradle Build 
Scan](https://gradle.com/build-scans) integrated. Each build on travis pushes 
scan reports to
+[Gradle Scan Community Hosted Server](https://scans.gradle.com). To see the 
scan report you need to check the travis build logs for lines like
+below 
+
+```
+Publishing build scan...
+https://gradle.com/s/reldo4qqlg3ka
+```
+
+The url above is the scan report url and is unique per build
+
 ## Troubleshooting
 
 If you encounter an error `ImportError: No module named pkg_resources` while 
running `redo`, try the workaround below


 


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


[GitHub] ddragosd commented on a change in pull request #97: Added maven archetype for Java Action

2018-02-23 Thread GitBox
ddragosd commented on a change in pull request #97: Added maven archetype for 
Java Action
URL: 
https://github.com/apache/incubator-openwhisk-devtools/pull/97#discussion_r170398377
 
 

 ##
 File path: java-action-archetype/README.md
 ##
 @@ -0,0 +1,39 @@
+# Maven Archetype for Java Action
+
+This archetype helps to generate the Java Action template project.
+
+## Pre-requisite
+
+The following softwares are required to build and deploy a Java Action to 
OpenWhisk:
+
+* (Maven v3.3.x)[https://maven.apache.org] or above
+* Java 8 or above
+
+[WSK 
CLI](https://github.com/apache/incubator-openwhisk/blob/master/docs/cli.md) is 
configured 
+
+## Generate project 
+
+```sh
+mvn archetype:generate \
+  -DarchetypeGroupId=org.apache.openwhisk.java \
+  -DarchetypeArtifactId=java-action-archetype \
+  -DarchetypeVersion=1.0-SNAPSHOT \
+  -DgroupId=com.example \
+  -DartifactId=demo-function
+```
+
+## Deploying function to OpenWhisk
+
+The following step shows how to deploy the function to OpenWhisk
+
+```sh
+cd demo-function
+mvn clean install
+wsk action create demo target/demo-function.jar 
 
 Review comment:
   I think we missed the `--main` here ?
   ```
   $ wsk action update demo target/demo-function.jar --main 
com.example.FunctionApp
   ```


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


[GitHub] ddragosd commented on a change in pull request #97: Added maven archetype for Java Action

2018-02-23 Thread GitBox
ddragosd commented on a change in pull request #97: Added maven archetype for 
Java Action
URL: 
https://github.com/apache/incubator-openwhisk-devtools/pull/97#discussion_r170398377
 
 

 ##
 File path: java-action-archetype/README.md
 ##
 @@ -0,0 +1,39 @@
+# Maven Archetype for Java Action
+
+This archetype helps to generate the Java Action template project.
+
+## Pre-requisite
+
+The following softwares are required to build and deploy a Java Action to 
OpenWhisk:
+
+* (Maven v3.3.x)[https://maven.apache.org] or above
+* Java 8 or above
+
+[WSK 
CLI](https://github.com/apache/incubator-openwhisk/blob/master/docs/cli.md) is 
configured 
+
+## Generate project 
+
+```sh
+mvn archetype:generate \
+  -DarchetypeGroupId=org.apache.openwhisk.java \
+  -DarchetypeArtifactId=java-action-archetype \
+  -DarchetypeVersion=1.0-SNAPSHOT \
+  -DgroupId=com.example \
+  -DartifactId=demo-function
+```
+
+## Deploying function to OpenWhisk
+
+The following step shows how to deploy the function to OpenWhisk
+
+```sh
+cd demo-function
+mvn clean install
+wsk action create demo target/demo-function.jar 
 
 Review comment:
   I think we missed the `--main` here ?
   ```
   $ wsk action create demo target/demo-function.jar --main 
com.example.FunctionApp
   ```


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


[GitHub] rabbah commented on issue #3341: Remove view supporting now removed API for listing assets in namespace.

2018-02-23 Thread GitBox
rabbah commented on issue #3341: Remove view supporting now removed API for 
listing assets in namespace.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3341#issuecomment-368171920
 
 
   So did I!


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


[GitHub] csantanapr commented on issue #3334: Cli ansible fix

2018-02-23 Thread GitBox
csantanapr commented on issue #3334: Cli ansible fix
URL: 
https://github.com/apache/incubator-openwhisk/pull/3334#issuecomment-368170143
 
 
   @jonpspri PG?


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


[GitHub] csantanapr commented on issue #3339: Add the empty NOTICE file for future development

2018-02-23 Thread GitBox
csantanapr commented on issue #3339: Add the empty NOTICE file for future 
development
URL: 
https://github.com/apache/incubator-openwhisk/pull/3339#issuecomment-368169993
 
 
   empty file WTF?


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


[GitHub] csantanapr commented on issue #3341: Remove view supporting now removed API for listing assets in namespace.

2018-02-23 Thread GitBox
csantanapr commented on issue #3341: Remove view supporting now removed API for 
listing assets in namespace.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3341#issuecomment-368169382
 
 
   I thought you already did


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


[GitHub] dgrove-oss commented on a change in pull request #3338: implement suspend/resume for KubernetesContainer

2018-02-23 Thread GitBox
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_r170387260
 
 

 ##
 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")
+  .addNewContainer()
+  .withNewResources()
+  .withLimits(mapAsJavaMap(Map("memory" -> new Quantity(memory.toMB + 
"Mi"
+  .endResources()
+  .withName("user-action")
+  .withImage(image)
+  .withEnv(envVars)
+  .addNewPort()
+  .withContainerPort(8080)
+  .withName("action")
+  .endPort()
+  .endContainer()
+  .endSpec()
+  .build()
+
+kubeRestClient.pods.inNamespace("openwhisk").create(pod)
 
-  def inspectIPAddress(id: ContainerId)(implicit transid: TransactionId): 
Future[ContainerAddress] = {
 Future {
   blocking {
-val pod =
-  
kubeRestClient.pods().withName(id.asString).waitUntilReady(timeouts.inspect.length,
 timeouts.inspect.unit)
-ContainerAddress(pod.getStatus().getPodIP())
+val createdPod = kubeRestClient.pods
+  .inNamespace("openwhisk")
+  .withName(name)
+  .waitUntilReady(config.timeouts.run.length, config.timeouts.run.unit)
+toContainer(createdPod)
   }
 }.recoverWith {
   case e =>
-log.error(this, s"Failed to get IP of Pod '${id.asString}' within 
timeout: ${e.getClass} - ${e.getMessage}")
-Future.failed(new Exception(s"Failed to get IP of Pod 
'${id.asString}'"))
+log.error(this, s"Failed create pod for '$name': ${e.getClass} - 
${e.getMessage}")
+Future.failed(new Exception(s"Failed to create pod '$name'"))
 }
   }
 
-  def rm(id: ContainerId)(implicit transid: TransactionId): Future[Unit] =
-runCmd(Seq("delete", "--now", "pod", id.asString), timeouts.rm).map(_ => 
())
+  def rm(container: KubernetesContainer)(implicit transid: TransactionId): 
Future[Unit] = {
+// Pod deletion will never complete if the pod contains a paused container.
+// Therefore issue a resume before the delete (resuming a non-suspended 
container is harmless).
+resume(container).map { _ =>
+  runCmd(Seq("delete", "--now", "pod", container.id.asString), 
config.timeouts.rm).map(_ => ())
+}
+  }
 
-  def rm(key: String, value: String)(implicit transid: TransactionId): 
Future[Unit] =
-runCmd(Seq("delete", "--now", "pod", "-l", s"$key=$value"), 
timeouts.rm).map(_ => ())
+  def rm(key: String, value: String)(implicit transid: TransactionId): 
Future[Unit] = {
+if (config.invokerAgent) {
+  Future {
+blocking {
+  kubeRestClient
+.inNamespace("openwhisk")
+.pods()
+.withLabel(key, value)
+.list()
+.getItems
+.map { pod =>
+  rm(toContainer(pod))
+}
+.reduce((a, b) => a.flatMap(_ => b))
+}
+  }
+} else {
+  runCmd(Seq("delete", "--now", "pod", "-l", s"$key=$value"), 
config.timeouts.rm).map(_ => ())
+}
+  }
 
-  def logs(id: ContainerId, sinceTime: Option[Instant], waitForSentinel: 
Boolean = false)(
+  def suspend(container: KubernetesContainer)(implicit transid: 
TransactionId): Future[Unit] = {
 
 Review comment:
   I think the implementations belong in the KubernetesClient, since they need 
access to some of its state too (its config object). 
   
   I agree passing the entire KubernetesContainer object as a parameter looks a 
bit backwards.  I decided to do that (instead of passing a few of its fields 
individually) as a hedge against future churn and because it felt like a nice 
logical unit (vs. passing containerId, workerIP, nativeContainerId).   But I 
don't feel that strongly about this.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 

[GitHub] rabbah opened a new pull request #3341: Remove view supporting now removed API for listing assets in namespace.

2018-02-23 Thread GitBox
rabbah opened a new pull request #3341: Remove view supporting now removed API 
for listing assets in namespace.
URL: https://github.com/apache/incubator-openwhisk/pull/3341
 
 
   


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


[GitHub] dgrove-oss commented on a change in pull request #3338: implement suspend/resume for KubernetesContainer

2018-02-23 Thread GitBox
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_r170385887
 
 

 ##
 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")
+  .addNewContainer()
+  .withNewResources()
+  .withLimits(mapAsJavaMap(Map("memory" -> new Quantity(memory.toMB + 
"Mi"
+  .endResources()
+  .withName("user-action")
+  .withImage(image)
+  .withEnv(envVars)
+  .addNewPort()
+  .withContainerPort(8080)
+  .withName("action")
+  .endPort()
+  .endContainer()
+  .endSpec()
+  .build()
+
+kubeRestClient.pods.inNamespace("openwhisk").create(pod)
 
-  def inspectIPAddress(id: ContainerId)(implicit transid: TransactionId): 
Future[ContainerAddress] = {
 Future {
   blocking {
-val pod =
-  
kubeRestClient.pods().withName(id.asString).waitUntilReady(timeouts.inspect.length,
 timeouts.inspect.unit)
-ContainerAddress(pod.getStatus().getPodIP())
+val createdPod = kubeRestClient.pods
+  .inNamespace("openwhisk")
+  .withName(name)
+  .waitUntilReady(config.timeouts.run.length, config.timeouts.run.unit)
+toContainer(createdPod)
   }
 }.recoverWith {
   case e =>
-log.error(this, s"Failed to get IP of Pod '${id.asString}' within 
timeout: ${e.getClass} - ${e.getMessage}")
-Future.failed(new Exception(s"Failed to get IP of Pod 
'${id.asString}'"))
+log.error(this, s"Failed create pod for '$name': ${e.getClass} - 
${e.getMessage}")
+Future.failed(new Exception(s"Failed to create pod '$name'"))
 }
   }
 
-  def rm(id: ContainerId)(implicit transid: TransactionId): Future[Unit] =
-runCmd(Seq("delete", "--now", "pod", id.asString), timeouts.rm).map(_ => 
())
+  def rm(container: KubernetesContainer)(implicit transid: TransactionId): 
Future[Unit] = {
+// Pod deletion will never complete if the pod contains a paused container.
+// Therefore issue a resume before the delete (resuming a non-suspended 
container is harmless).
+resume(container).map { _ =>
 
 Review comment:
   Makes sense; I restructured.


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


[GitHub] dgrove-oss commented on a change in pull request #3338: implement suspend/resume for KubernetesContainer

2018-02-23 Thread GitBox
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


[GitHub] rabbah commented on issue #3318: Remove restriction on updating a trigger with a new feed.

2018-02-23 Thread GitBox
rabbah commented on issue #3318: Remove restriction on updating a trigger with 
a new feed.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3318#issuecomment-368156182
 
 
   PG3/1901 ? 


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


[GitHub] csantanapr commented on issue #3335: Allow container tests to run without a proxy.

2018-02-23 Thread GitBox
csantanapr commented on issue #3335: Allow container tests to run without a 
proxy.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3335#issuecomment-368153588
 
 
   @rabbah Yeah we need to see if we can re-use this class in the runtime 
repos. Can't remember why I copied the class. I guess I didn't know much scala 
then.
   


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


[GitHub] csantanapr commented on issue #3335: Allow container tests to run without a proxy.

2018-02-23 Thread GitBox
csantanapr commented on issue #3335: Allow container tests to run without a 
proxy.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3335#issuecomment-368153588
 
 
   Yeah we need to see if we can re-use this class in the runtime repos. Can't 
remember why I copied the class. I guess I didn't know much scala then.
   


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


[GitHub] csantanapr commented on a change in pull request #3335: Allow container tests to run without a proxy.

2018-02-23 Thread GitBox
csantanapr commented on a change in pull request #3335: Allow container tests 
to run without a proxy.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3335#discussion_r170381377
 
 

 ##
 File path: tests/src/test/scala/actionContainers/ActionContainer.scala
 ##
 @@ -135,19 +135,32 @@ object ActionContainer {
   case (k, v) => s"-e ${k}=${v}"
 } mkString (" ")
 
-// We create the container...
-val runOut = awaitDocker(s"run --name $name $envArgs -d $imageName", 10 
seconds)
-assert(runOut._1 == 0, "'docker run' did not exit with 0: " + runOut)
+// We create the container... and find out its IP address...
+def createContainer(portFwd: Option[Int] = None) = {
+  val runOut = awaitDocker(
+s"run ${portFwd.map(p => s"-p $p:8080").getOrElse("")} --name $name 
$envArgs -d $imageName",
 
 Review comment:
   @rabbah I thought we try at one point to remove the proxy but we ran into 
trouble, and that's we have the proxy.
   
   can't recall now why didn't push forward for a solution.
   
   But this would be great if we can get rid off the proxy.


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


[GitHub] rabbah commented on issue #3340: Default activation response to empty JsObject.

2018-02-23 Thread GitBox
rabbah commented on issue #3340: Default activation response to empty JsObject.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3340#issuecomment-368150368
 
 
   could be... or remove the option and use an empty object. None is used on 
the non-blocking path so the result doesn?t matter. 


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


[GitHub] houshengbo commented on issue #3339: Add the empty NOTICE file for future development

2018-02-23 Thread GitBox
houshengbo commented on issue #3339: Add the empty NOTICE file for future 
development
URL: 
https://github.com/apache/incubator-openwhisk/pull/3339#issuecomment-368145751
 
 
   @rabbah Apache does not define the suffix of the license and notice files. I 
think we can use any suffix for them.


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


[GitHub] markusthoemmes commented on issue #3340: Default activation response to empty JsObject.

2018-02-23 Thread GitBox
markusthoemmes commented on issue #3340: Default activation response to empty 
JsObject.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3340#issuecomment-368146726
 
 
   I discovered it in a loopback invoker test where I stubbed the invoker out. 
Was a mere accident. I was thinking though if we should change the type of 
`reponse` to not be `Option`. Didn't try what that'd mean though.


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


[GitHub] houshengbo commented on issue #3339: Add the empty NOTICE file for future development

2018-02-23 Thread GitBox
houshengbo commented on issue #3339: Add the empty NOTICE file for future 
development
URL: 
https://github.com/apache/incubator-openwhisk/pull/3339#issuecomment-368145751
 
 
   @rabbah Apache does not define the suffix of the license and notice files. I 
need to confirm whether we can use .md files.


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


[GitHub] rabbah commented on issue #3340: Default activation response to empty JsObject.

2018-02-23 Thread GitBox
rabbah commented on issue #3340: Default activation response to empty JsObject.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3340#issuecomment-368144952
 
 
   This is OK - where are we using the response result though incorrectly; 
isn't there another bug?


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


[GitHub] markusthoemmes commented on a change in pull request #3333: Make parameters with defined values final

2018-02-23 Thread GitBox
markusthoemmes commented on a change in pull request #: Make parameters 
with defined values final 
URL: 
https://github.com/apache/incubator-openwhisk/pull/#discussion_r170372376
 
 

 ##
 File path: core/controller/src/main/scala/whisk/core/controller/Actions.scala
 ##
 @@ -226,38 +226,17 @@ trait WhiskActionsApi extends WhiskCollectionAPI with 
PostActionActivation with
 onComplete(entitleReferencedEntitiesMetaData(user, 
Privilege.ACTIVATE, Some(action.exec))) {
   case Success(_) =>
 val actionWithMergedParams = env.map(action.inherit(_)) 
getOrElse action
-val waitForResponse = if (blocking) Some(waitOverride) else 
None
-onComplete(invokeAction(user, actionWithMergedParams, payload, 
waitForResponse, cause = None)) {
-  case Success(Left(activationId)) =>
-// non-blocking invoke or blocking invoke which got queued 
instead
-complete(Accepted, activationId.toJsObject)
-  case Success(Right(activation)) =>
-val response = if (result) activation.resultAsJson else 
activation.toExtendedJson
-
-if (activation.response.isSuccess) {
-  complete(OK, response)
-} else if (activation.response.isApplicationError) {
-  // actions that result is ApplicationError status are 
considered a 'success'
-  // and will have an 'error' property in the result - the 
HTTP status is OK
-  // and clients must check the response status if it 
exists
-  // NOTE: response status will not exist in the JSON 
object if ?result == true
-  // and instead clients must check if 'error' is in the 
JSON
-  // PRESERVING OLD BEHAVIOR and will address defect in 
separate change
-  complete(BadGateway, response)
-} else if (activation.response.isContainerError) {
-  complete(BadGateway, response)
-} else {
-  complete(InternalServerError, response)
-}
-  case Failure(t: RecordTooLargeException) =>
-logging.debug(this, s"[POST] action payload was too large")
-terminate(RequestEntityTooLarge)
-  case Failure(RejectRequest(code, message)) =>
-logging.debug(this, s"[POST] action rejected with code 
$code: $message")
-terminate(code, message)
-  case Failure(t: Throwable) =>
-logging.error(this, s"[POST] action activation failed: 
${t.getMessage}")
-terminate(InternalServerError)
+
+// incoming parameters may not override final parameters 
(i.e., parameters with already defined values)
+// on an action once its parameters are resolved across 
package and binding
+val allowInvoke = payload
+  
.map(_.fields.keySet.intersect(actionWithMergedParams.immutableParameters).isEmpty)
 
 Review comment:
   ```scala
   _.fields.keySet.forall(key => 
!actionWithMergedParams.immutableParameters.contains(key))
   ```
   
   for an early exit on violation instead of computing the whole intersection?


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


[GitHub] rabbah commented on issue #3333: Make parameters with defined values final

2018-02-23 Thread GitBox
rabbah commented on issue #: Make parameters with defined values final 
URL: 
https://github.com/apache/incubator-openwhisk/pull/#issuecomment-368142579
 
 
   pg1/2649 ? 


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


[GitHub] dubeejw commented on issue #176: Only fetch action code when saving an action

2018-02-23 Thread GitBox
dubeejw commented on issue #176: Only fetch action code when saving an action
URL: 
https://github.com/apache/incubator-openwhisk-cli/pull/176#issuecomment-350515547
 
 
   Example output: 
   ```
   ./wsk action get test -i
   ok: got action test
   {
   "namespace": "test@test",
   "name": "test",
   "version": "0.0.1",
   "exec": {
   "kind": "nodejs:6",
   "binary": false
   },
   "annotations": [
   {
   "key": "exec",
   "value": "nodejs:6"
   }
   ],
   "limits": {
   "timeout": 6,
   "memory": 256,
   "logs": 10
   },
   "publish": false
   }
   
   ```


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


[GitHub] dubeejw closed pull request #63: Parse new 'rules' field in 'trigger get' response

2018-02-23 Thread GitBox
dubeejw closed pull request #63: Parse new 'rules' field in 'trigger get' 
response
URL: https://github.com/apache/incubator-openwhisk-client-go/pull/63
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/whisk/trigger.go b/whisk/trigger.go
index 63d456f2..ed0fd7e7 100644
--- a/whisk/trigger.go
+++ b/whisk/trigger.go
@@ -27,18 +27,19 @@ import (
 )
 
 type TriggerService struct {
-   client *Client
+   client ClientInterface
 }
 
 type Trigger struct {
-   Namespacestring  `json:"namespace,omitempty"`
-   Name string  `json:"name,omityempty"`
-   Version  string  `json:"version,omitempty"`
-   ActivationId string  `json:"activationId,omitempty"`
-   Annotations  KeyValueArr `json:"annotations,omitempty"`
-   Parameters   KeyValueArr `json:"parameters,omitempty"`
-   Limits   *Limits `json:"limits,omitempty"`
-   Publish  *bool   `json:"publish,omitempty"`
+   Namespacestring `json:"namespace,omitempty"`
+   Name string `json:"name,omityempty"`
+   Version  string `json:"version,omitempty"`
+   ActivationId string `json:"activationId,omitempty"`
+   Annotations  KeyValueArr`json:"annotations,omitempty"`
+   Parameters   KeyValueArr`json:"parameters,omitempty"`
+   Limits   *Limits`json:"limits,omitempty"`
+   Publish  *bool  `json:"publish,omitempty"`
+   Rulesmap[string]interface{} `json:"rules,omitempty"`
 }
 
 type TriggerListOptions struct {
diff --git a/whisk/trigger_test.go b/whisk/trigger_test.go
new file mode 100644
index ..14dbc080
--- /dev/null
+++ b/whisk/trigger_test.go
@@ -0,0 +1,131 @@
+// +build unit
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package whisk
+
+import (
+   "encoding/json"
+   "fmt"
+   "github.com/stretchr/testify/assert"
+   "io/ioutil"
+   "net/http"
+   "net/url"
+   "strings"
+   "testing"
+)
+
+const (
+   TRIGGER_GET_NO_RULES = `{
+"namespace": "test@openwhisk_dev",
+"name": "testTrigger",
+"publish": false,
+"version": "0.0.1",
+"limits": {}
+}`
+
+   TRIGGER_GET_WITH_RULES = `{
+"namespace": "test@openwhisk_dev",
+"name": "testTrigger",
+"publish": false,
+"version": "0.0.1",
+"limits": {},
+"rules": {
+"guest/inactiverule": {
+"action": {
+"name": "web-echo-env",
+"path": "guest"
+},
+"status": "inactive"
+}
+}
+}`
+)
+
+type TriggerResponse struct {
+   Body string
+}
+
+type TriggerRequest struct {
+   Method string
+   URLstring
+}
+
+var triggerResponse = {}
+var triggerRequest = {}
+
+type MockTriggerClient struct{}
+
+func (c *MockTriggerClient) NewRequestUrl(method string, urlRelResource 
*url.URL, body interface{}, includeNamespaceInUrl bool, appendOpenWhiskPath 
bool, encodeBodyAs string, useAuthentication bool) (*http.Request, error) {
+   return {}, nil
+}
+
+func (c *MockTriggerClient) NewRequest(method, urlStr string, body 
interface{}, includeNamespaceInUrl bool) (*http.Request, error) {
+   triggerRequest.Method = method
+   triggerRequest.URL = urlStr
+
+   request, err := http.NewRequest(method, urlStr, nil)
+   if err != nil {
+   fmt.Printf("http.NewRequest() failure: %s\n", err)
+   return {}, err
+   }
+
+   return request, nil
+}
+
+func (c *MockTriggerClient) Do(req *http.Request, v interface{}, 
ExitWithErrorOnTimeout bool, secretToObfuscate 

[GitHub] dubeejw closed pull request #220: WIP: test travis

2018-02-23 Thread GitBox
dubeejw closed pull request #220: WIP: test travis
URL: https://github.com/apache/incubator-openwhisk-cli/pull/220
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/build.gradle b/build.gradle
index 29bedf25..40845b11 100644
--- a/build.gradle
+++ b/build.gradle
@@ -34,6 +34,7 @@ dependencies {
 }
 }
 
+
 /*
 The OpenWhiskPlatform class is a utility class to make the rest of what
 happens with platforms a bit more understandable.  A "Platform" is a tuple


 


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


[GitHub] houshengbo opened a new pull request #65: Add the empty NOTICE file for further development

2018-02-23 Thread GitBox
houshengbo opened a new pull request #65: Add the empty NOTICE file for further 
development
URL: https://github.com/apache/incubator-openwhisk-client-go/pull/65
 
 
   


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


[GitHub] dubeejw commented on issue #176: Only fetch action code when saving an action

2018-02-23 Thread GitBox
dubeejw commented on issue #176: Only fetch action code when saving an action
URL: 
https://github.com/apache/incubator-openwhisk-cli/pull/176#issuecomment-368137707
 
 
   @mdeuser, any comments here?


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


[GitHub] markusthoemmes commented on a change in pull request #3338: implement suspend/resume for KubernetesContainer

2018-02-23 Thread GitBox
markusthoemmes commented on a change in pull request #3338: implement 
suspend/resume for KubernetesContainer
URL: 
https://github.com/apache/incubator-openwhisk/pull/3338#discussion_r170363289
 
 

 ##
 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")
+  .addNewContainer()
+  .withNewResources()
+  .withLimits(mapAsJavaMap(Map("memory" -> new Quantity(memory.toMB + 
"Mi"
+  .endResources()
+  .withName("user-action")
+  .withImage(image)
+  .withEnv(envVars)
+  .addNewPort()
+  .withContainerPort(8080)
+  .withName("action")
+  .endPort()
+  .endContainer()
+  .endSpec()
+  .build()
+
+kubeRestClient.pods.inNamespace("openwhisk").create(pod)
 
-  def inspectIPAddress(id: ContainerId)(implicit transid: TransactionId): 
Future[ContainerAddress] = {
 Future {
   blocking {
-val pod =
-  
kubeRestClient.pods().withName(id.asString).waitUntilReady(timeouts.inspect.length,
 timeouts.inspect.unit)
-ContainerAddress(pod.getStatus().getPodIP())
+val createdPod = kubeRestClient.pods
+  .inNamespace("openwhisk")
+  .withName(name)
+  .waitUntilReady(config.timeouts.run.length, config.timeouts.run.unit)
+toContainer(createdPod)
   }
 }.recoverWith {
   case e =>
-log.error(this, s"Failed to get IP of Pod '${id.asString}' within 
timeout: ${e.getClass} - ${e.getMessage}")
-Future.failed(new Exception(s"Failed to get IP of Pod 
'${id.asString}'"))
+log.error(this, s"Failed create pod for '$name': ${e.getClass} - 
${e.getMessage}")
+Future.failed(new Exception(s"Failed to create pod '$name'"))
 }
   }
 
-  def rm(id: ContainerId)(implicit transid: TransactionId): Future[Unit] =
-runCmd(Seq("delete", "--now", "pod", id.asString), timeouts.rm).map(_ => 
())
+  def rm(container: KubernetesContainer)(implicit transid: TransactionId): 
Future[Unit] = {
+// Pod deletion will never complete if the pod contains a paused container.
+// Therefore issue a resume before the delete (resuming a non-suspended 
container is harmless).
+resume(container).map { _ =>
 
 Review comment:
   This should be taken care of by the container lifecycle.


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


[GitHub] markusthoemmes commented on a change in pull request #3338: implement suspend/resume for KubernetesContainer

2018-02-23 Thread GitBox
markusthoemmes commented on a change in pull request #3338: implement 
suspend/resume for KubernetesContainer
URL: 
https://github.com/apache/incubator-openwhisk/pull/3338#discussion_r170363985
 
 

 ##
 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")
+  .addNewContainer()
+  .withNewResources()
+  .withLimits(mapAsJavaMap(Map("memory" -> new Quantity(memory.toMB + 
"Mi"
+  .endResources()
+  .withName("user-action")
+  .withImage(image)
+  .withEnv(envVars)
+  .addNewPort()
+  .withContainerPort(8080)
+  .withName("action")
+  .endPort()
+  .endContainer()
+  .endSpec()
+  .build()
+
+kubeRestClient.pods.inNamespace("openwhisk").create(pod)
 
-  def inspectIPAddress(id: ContainerId)(implicit transid: TransactionId): 
Future[ContainerAddress] = {
 Future {
   blocking {
-val pod =
-  
kubeRestClient.pods().withName(id.asString).waitUntilReady(timeouts.inspect.length,
 timeouts.inspect.unit)
-ContainerAddress(pod.getStatus().getPodIP())
+val createdPod = kubeRestClient.pods
+  .inNamespace("openwhisk")
+  .withName(name)
+  .waitUntilReady(config.timeouts.run.length, config.timeouts.run.unit)
+toContainer(createdPod)
   }
 }.recoverWith {
   case e =>
-log.error(this, s"Failed to get IP of Pod '${id.asString}' within 
timeout: ${e.getClass} - ${e.getMessage}")
-Future.failed(new Exception(s"Failed to get IP of Pod 
'${id.asString}'"))
+log.error(this, s"Failed create pod for '$name': ${e.getClass} - 
${e.getMessage}")
+Future.failed(new Exception(s"Failed to create pod '$name'"))
 }
   }
 
-  def rm(id: ContainerId)(implicit transid: TransactionId): Future[Unit] =
-runCmd(Seq("delete", "--now", "pod", id.asString), timeouts.rm).map(_ => 
())
+  def rm(container: KubernetesContainer)(implicit transid: TransactionId): 
Future[Unit] = {
+// Pod deletion will never complete if the pod contains a paused container.
+// Therefore issue a resume before the delete (resuming a non-suspended 
container is harmless).
+resume(container).map { _ =>
+  runCmd(Seq("delete", "--now", "pod", container.id.asString), 
config.timeouts.rm).map(_ => ())
+}
+  }
 
-  def rm(key: String, value: String)(implicit transid: TransactionId): 
Future[Unit] =
-runCmd(Seq("delete", "--now", "pod", "-l", s"$key=$value"), 
timeouts.rm).map(_ => ())
+  def rm(key: String, value: String)(implicit transid: TransactionId): 
Future[Unit] = {
+if (config.invokerAgent) {
+  Future {
+blocking {
+  kubeRestClient
+.inNamespace("openwhisk")
+.pods()
+.withLabel(key, value)
+.list()
+.getItems
+.map { pod =>
+  rm(toContainer(pod))
+}
+.reduce((a, b) => a.flatMap(_ => b))
+}
+  }
+} else {
+  runCmd(Seq("delete", "--now", "pod", "-l", s"$key=$value"), 
config.timeouts.rm).map(_ => ())
+}
+  }
 
-  def logs(id: ContainerId, sinceTime: Option[Instant], waitForSentinel: 
Boolean = false)(
+  def suspend(container: KubernetesContainer)(implicit transid: 
TransactionId): Future[Unit] = {
+if (config.invokerAgent) {
+  // Forward command to invoker-agent daemonset instance on container's 
worker node
+  Http()
+.singleRequest(HttpRequest(
+  uri = "http://; + container.workerIP + ":" + config.invokerAgentPort 
+ "/suspend/" + container.nativeContainerId))
 
 Review comment:
   Could make use of `akka-http`s `Uri` API:
   
   ```scala
   
Uri().withScheme("http").withHost(container.workerIp).withPort(config.invokerAgentPort).withPath(/
 "suspend" / container.nativeContainerId)
   ```


This is an automated message from the Apache Git Service.
To respond to the 

[GitHub] markusthoemmes commented on a change in pull request #3338: implement suspend/resume for KubernetesContainer

2018-02-23 Thread GitBox
markusthoemmes commented on a change in pull request #3338: implement 
suspend/resume for KubernetesContainer
URL: 
https://github.com/apache/incubator-openwhisk/pull/3338#discussion_r170362912
 
 

 ##
 File path: 
core/invoker/src/main/scala/whisk/core/containerpool/kubernetes/KubernetesClient.scala
 ##
 @@ -41,17 +45,19 @@ import whisk.core.ConfigKeys
 import whisk.core.containerpool.ContainerId
 import whisk.core.containerpool.ContainerAddress
 import whisk.core.containerpool.docker.ProcessRunner
+import whisk.core.entity.ByteSize
+import whisk.core.entity.size._
 
 import scala.concurrent.duration.Duration
 import scala.concurrent.ExecutionContext
 import scala.concurrent.Future
 import scala.concurrent.blocking
-import scala.concurrent.duration._
 import scala.util.Failure
 import scala.util.Success
 import scala.util.Try
 import spray.json._
 import spray.json.DefaultJsonProtocol._
+import collection.JavaConversions._
 
 Review comment:
   Please use `JavaConverters`. They'll allow you to write `asJava` or 
`asScala` after a usual `Map` for example. `JavaConversions` makes heavy use of 
implicits and are discouraged.


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


[GitHub] markusthoemmes commented on a change in pull request #3338: implement suspend/resume for KubernetesContainer

2018-02-23 Thread GitBox
markusthoemmes commented on a change in pull request #3338: implement 
suspend/resume for KubernetesContainer
URL: 
https://github.com/apache/incubator-openwhisk/pull/3338#discussion_r170364578
 
 

 ##
 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")
+  .addNewContainer()
+  .withNewResources()
+  .withLimits(mapAsJavaMap(Map("memory" -> new Quantity(memory.toMB + 
"Mi"
+  .endResources()
+  .withName("user-action")
+  .withImage(image)
+  .withEnv(envVars)
+  .addNewPort()
+  .withContainerPort(8080)
+  .withName("action")
+  .endPort()
+  .endContainer()
+  .endSpec()
+  .build()
+
+kubeRestClient.pods.inNamespace("openwhisk").create(pod)
 
-  def inspectIPAddress(id: ContainerId)(implicit transid: TransactionId): 
Future[ContainerAddress] = {
 Future {
   blocking {
-val pod =
-  
kubeRestClient.pods().withName(id.asString).waitUntilReady(timeouts.inspect.length,
 timeouts.inspect.unit)
-ContainerAddress(pod.getStatus().getPodIP())
+val createdPod = kubeRestClient.pods
+  .inNamespace("openwhisk")
+  .withName(name)
+  .waitUntilReady(config.timeouts.run.length, config.timeouts.run.unit)
+toContainer(createdPod)
   }
 }.recoverWith {
   case e =>
-log.error(this, s"Failed to get IP of Pod '${id.asString}' within 
timeout: ${e.getClass} - ${e.getMessage}")
-Future.failed(new Exception(s"Failed to get IP of Pod 
'${id.asString}'"))
+log.error(this, s"Failed create pod for '$name': ${e.getClass} - 
${e.getMessage}")
+Future.failed(new Exception(s"Failed to create pod '$name'"))
 }
   }
 
-  def rm(id: ContainerId)(implicit transid: TransactionId): Future[Unit] =
-runCmd(Seq("delete", "--now", "pod", id.asString), timeouts.rm).map(_ => 
())
+  def rm(container: KubernetesContainer)(implicit transid: TransactionId): 
Future[Unit] = {
+// Pod deletion will never complete if the pod contains a paused container.
+// Therefore issue a resume before the delete (resuming a non-suspended 
container is harmless).
+resume(container).map { _ =>
+  runCmd(Seq("delete", "--now", "pod", container.id.asString), 
config.timeouts.rm).map(_ => ())
+}
+  }
 
-  def rm(key: String, value: String)(implicit transid: TransactionId): 
Future[Unit] =
-runCmd(Seq("delete", "--now", "pod", "-l", s"$key=$value"), 
timeouts.rm).map(_ => ())
+  def rm(key: String, value: String)(implicit transid: TransactionId): 
Future[Unit] = {
+if (config.invokerAgent) {
+  Future {
+blocking {
+  kubeRestClient
+.inNamespace("openwhisk")
+.pods()
+.withLabel(key, value)
+.list()
+.getItems
+.map { pod =>
+  rm(toContainer(pod))
+}
+.reduce((a, b) => a.flatMap(_ => b))
+}
+  }
+} else {
+  runCmd(Seq("delete", "--now", "pod", "-l", s"$key=$value"), 
config.timeouts.rm).map(_ => ())
+}
+  }
 
-  def logs(id: ContainerId, sinceTime: Option[Instant], waitForSentinel: 
Boolean = false)(
+  def suspend(container: KubernetesContainer)(implicit transid: 
TransactionId): Future[Unit] = {
 
 Review comment:
   Should we move those to the container instead of "faking" them in the 
client? Seems weird to pass the whole container to the client.


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


[GitHub] markusthoemmes commented on a change in pull request #3338: implement suspend/resume for KubernetesContainer

2018-02-23 Thread GitBox
markusthoemmes commented on a change in pull request #3338: implement 
suspend/resume for KubernetesContainer
URL: 
https://github.com/apache/incubator-openwhisk/pull/3338#discussion_r170363009
 
 

 ##
 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:
   Do we really want user-pods restarted?


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


[GitHub] houshengbo opened a new pull request #230: Add the LICENSE file and empty NOTICE file

2018-02-23 Thread GitBox
houshengbo opened a new pull request #230: Add the LICENSE file and empty 
NOTICE file
URL: https://github.com/apache/incubator-openwhisk-cli/pull/230
 
 
   


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


[GitHub] houshengbo opened a new pull request #753: Add the empty NOTICE for further development

2018-02-23 Thread GitBox
houshengbo opened a new pull request #753: Add the empty NOTICE for further 
development
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/753
 
 
   


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


[GitHub] dgrove-oss commented on issue #3338: implement suspend/resume for KubernetesContainer

2018-02-23 Thread GitBox
dgrove-oss commented on issue #3338: implement suspend/resume for 
KubernetesContainer
URL: 
https://github.com/apache/incubator-openwhisk/pull/3338#issuecomment-368132145
 
 
   @jcrossley3 @bbrowning @bwmcadams  Please review proposed k8s changes.  
Thanks.


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


[GitHub] houshengbo opened a new pull request #3339: Add the empty NOTICE file for future development

2018-02-23 Thread GitBox
houshengbo opened a new pull request #3339: Add the empty NOTICE file for 
future development
URL: https://github.com/apache/incubator-openwhisk/pull/3339
 
 
   This PR adds an empty NOTICE file for future use of release, since for each 
release as an Apache project, we need to edit this NOTICE file accordingly.


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


[GitHub] dgrove-oss opened a new pull request #3338: implement suspend/resume for KubernetesContainer

2018-02-23 Thread GitBox
dgrove-oss opened a new pull request #3338: implement suspend/resume for 
KubernetesContainer
URL: https://github.com/apache/incubator-openwhisk/pull/3338
 
 
   We can implement suspend and resume for KubernetesContainerPool by 
delegating the operations to an invoker-agent that runs as a DaemonSet on every 
invoker node.  The invoker-agent interacts with the local docker/containerd 
engine to pause/unpause containers as directed by the invoker.
   
   This PR contains the OpenWhisk core changes to implement this design.  It 
assumes an invoker-agent as implemented in 
https://github.com/apache/incubator-openwhisk-deploy-kube/pull/155.  The main 
changes in this PR are:
   1.  Add configuration for the invoker-agent to application.conf (default to 
disabled).
   2. Implement suspend/resume by delegating to the invoker-agent
   3. Change the implementation of container creation to use the kubeRestClient 
to create the containers instead of using the kubectl command line.  As part of 
creation we now extract and save the workerNode IP information in the 
KubernetesContainer to cache the information needed to communicate with the 
invoker-agent.
   4. Update test cases for changes in the KubernetesClient API.
   
   If you look into the invoker-agent code in openwhisk-deploy-kube code, you 
will see that it also support log consolidation.   I plan to submit a separate 
PR for the openwhisk core side of the logging changes (because it also includes 
a modest refactor to the logging implementation that should be reviewed 
separately from the Kubernetes-centric changes in this PR).

   


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


[GitHub] houshengbo opened a new pull request #48: Add the support to check the existence of NOTICE and LICENSE files

2018-02-23 Thread GitBox
houshengbo opened a new pull request #48: Add the support to check the 
existence of NOTICE and LICENSE files
URL: https://github.com/apache/incubator-openwhisk-release/pull/48
 
 
   


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


[GitHub] rabbah commented on issue #3335: Allow container tests to run without a proxy.

2018-02-23 Thread GitBox
rabbah commented on issue #3335: Allow container tests to run without a proxy.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3335#issuecomment-368124838
 
 
   There may be a heisenbug with my sleep hack - several travis builds failed 
in a row. Will have to investigate that.


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


[GitHub] rabbah closed pull request #3332: Add '-e' to redo for ansible variables and change '-a' to gradle arguments only.

2018-02-23 Thread GitBox
rabbah closed pull request #3332: Add '-e' to redo for ansible variables and 
change '-a' to gradle arguments only.
URL: https://github.com/apache/incubator-openwhisk/pull/3332
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/tools/build/redo b/tools/build/redo
index b152c24e34..6dc3cd8283 100755
--- a/tools/build/redo
+++ b/tools/build/redo
@@ -93,7 +93,8 @@ def getArgs():
 parser.add_argument('-g', '--gradle', help='use target using inferred 
gradle file if component is not one of known targets', action='store_const', 
const=True, default=False)
 parser.add_argument('-n', '--just-print', help='prints the component 
configuration but does not run any targets', action='store_const', const=True, 
default=False, dest='skiprun')
 parser.add_argument('-c', '--list-components', help='list known component 
names and exit', action='store_const', const=True, default=False, dest='list')
-parser.add_argument('-a', '--additional-task-arguments', dest='extraArgs', 
action='append', help='pass additional arguments to underlying task command')
+parser.add_argument('-a', '--additional-task-arguments', dest='extraArgs', 
action='append', help='pass additional arguments to gradle build')
+parser.add_argument('-e', '--extra-ansible-vars', dest='extraAnsibleVars', 
action='append', help='pass extra vars to ansible-playbook')
 parser.add_argument('components', nargs = '*', help='component name(s) to 
run (in order specified if more than one)')
 parser.add_argument('--dir', help='whisk home directory')
 
@@ -144,7 +145,7 @@ class Playbook:
 def path(self, basedir):
 return basedir + '/' + self.dir
 
-def execcmd(self, props, mode = False, extraArgs = ''):
+def execcmd(self, props, mode = False, extraAnsibleVars = []):
 if self.dir and self.file and (mode is False or mode in self.modes):
 cmd = [ self.cmd ]
 if self.env:
@@ -152,8 +153,8 @@ class Playbook:
 cmd.append(self.file)
 if mode:
 cmd.append('-e mode=%s' % mode)
-if extraArgs is not '':
-cmd.append(extraArgs)
+if extraAnsibleVars:
+cmd.append(' '.join(map(lambda x: "-e '" + str(x) + "'", 
extraAnsibleVars)))
 return ' '.join(cmd)
 
 class Gradle:
@@ -393,11 +394,11 @@ def doOne(component, args, props):
 run(cmd, basedir, args.skiprun)
 
 if args.teardown and playbook is not None:
-cmd = playbook.execcmd(props, 'clean', extraArgs = extraArgs)
+cmd = playbook.execcmd(props, 'clean', extraAnsibleVars = 
args.extraAnsibleVars)
 run(cmd, playbook.path(basedir), args.skiprun)
 
 if args.deploy and playbook is not None:
-cmd = playbook.execcmd(props, extraArgs = extraArgs)
+cmd = playbook.execcmd(props, extraAnsibleVars = args.extraAnsibleVars)
 run(cmd, playbook.path(basedir), args.skiprun)
 
 if __name__ == '__main__':


 


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


[GitHub] rabbah commented on issue #3215: adding namePrefix config to ContainerArgsConfig

2018-02-23 Thread GitBox
rabbah commented on issue #3215: adding namePrefix config to ContainerArgsConfig
URL: 
https://github.com/apache/incubator-openwhisk/pull/3215#issuecomment-368123776
 
 
   Restarted Travis.


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


[GitHub] rabbah closed pull request #3331: Make package test resilient against eventual consistency.

2018-02-23 Thread GitBox
rabbah closed pull request #3331: Make package test resilient against eventual 
consistency.
URL: https://github.com/apache/incubator-openwhisk/pull/3331
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/tests/src/test/scala/whisk/core/controller/test/PackagesApiTests.scala 
b/tests/src/test/scala/whisk/core/controller/test/PackagesApiTests.scala
index 9dbb8c2f08..c0e2e40223 100644
--- a/tests/src/test/scala/whisk/core/controller/test/PackagesApiTests.scala
+++ b/tests/src/test/scala/whisk/core/controller/test/PackagesApiTests.scala
@@ -335,11 +335,14 @@ class PackagesApiTests extends ControllerTestCommon with 
WhiskPackagesApi {
   aname(),
   jsDefault("??"),
   annotations = Parameters(Parameters.Feed, "true"))
+
 put(entityStore, provider)
 put(entityStore, reference)
 put(entityStore, action)
 put(entityStore, feed)
 
+waitOnView(entityStore, WhiskAction, provider.fullPath, 2)
+
 // it should "reject get package reference from other subject" in {
 val auser = WhiskAuthHelpers.newIdentity()
 Get(s"/$namespace/${collection.path}/${reference.name}") ~> 
Route.seal(routes(auser)) ~> check {
@@ -349,7 +352,7 @@ class PackagesApiTests extends ControllerTestCommon with 
WhiskPackagesApi {
 Get(s"$collectionPath/${reference.name}") ~> Route.seal(routes(creds)) ~> 
check {
   status should be(OK)
   val response = responseAs[WhiskPackageWithActions]
-  response should be(reference withActions (List(action, feed)))
+  response should be(reference withActions List(action, feed))
 }
   }
 


 


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


[GitHub] markusthoemmes opened a new pull request #3337: Put active-ack consumers in their own consumer-groups.

2018-02-23 Thread GitBox
markusthoemmes opened a new pull request #3337: Put active-ack consumers in 
their own consumer-groups.
URL: https://github.com/apache/incubator-openwhisk/pull/3337
 
 
   Just like with the invoker consumers, it doesn't make sense to have those in 
one group as crash of one will cause a rebalancing pause for the other.


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


[GitHub] markusthoemmes closed pull request #3330: Update Log Store Fetch

2018-02-23 Thread GitBox
markusthoemmes closed pull request #3330: Update Log Store Fetch
URL: https://github.com/apache/incubator-openwhisk/pull/3330
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/common/scala/src/main/scala/whisk/core/containerpool/logging/DockerToActivationFileLogStore.scala
 
b/common/scala/src/main/scala/whisk/core/containerpool/logging/DockerToActivationFileLogStore.scala
index f9ec413c38..4be36a730a 100644
--- 
a/common/scala/src/main/scala/whisk/core/containerpool/logging/DockerToActivationFileLogStore.scala
+++ 
b/common/scala/src/main/scala/whisk/core/containerpool/logging/DockerToActivationFileLogStore.scala
@@ -18,6 +18,7 @@
 package whisk.core.containerpool.logging
 
 import java.nio.file.{Path, Paths}
+import java.time.Instant
 
 import akka.NotUsed
 import akka.actor.ActorSystem
@@ -25,15 +26,15 @@ import akka.stream.alpakka.file.scaladsl.LogRotatorSink
 import akka.stream.{Graph, SinkShape, UniformFanOutShape}
 import akka.stream.scaladsl.{Broadcast, Flow, GraphDSL, Keep, MergeHub, Sink, 
Source}
 import akka.util.ByteString
+
 import whisk.common.TransactionId
 import whisk.core.containerpool.Container
 import whisk.core.entity.{ActivationLogs, ExecutableWhiskAction, Identity, 
WhiskActivation}
 import whisk.core.entity.size._
+import whisk.http.Messages
+
 import spray.json._
 import spray.json.DefaultJsonProtocol._
-import java.time.Instant
-
-import whisk.http.Messages
 
 import scala.concurrent.Future
 
diff --git 
a/common/scala/src/main/scala/whisk/core/containerpool/logging/DockerToActivationLogStore.scala
 
b/common/scala/src/main/scala/whisk/core/containerpool/logging/DockerToActivationLogStore.scala
index 153aa59c67..b4e3983af4 100644
--- 
a/common/scala/src/main/scala/whisk/core/containerpool/logging/DockerToActivationLogStore.scala
+++ 
b/common/scala/src/main/scala/whisk/core/containerpool/logging/DockerToActivationLogStore.scala
@@ -19,18 +19,21 @@ package whisk.core.containerpool.logging
 
 import akka.NotUsed
 import akka.actor.ActorSystem
+import akka.http.scaladsl.model.HttpRequest
 import akka.stream.ActorMaterializer
 import akka.stream.scaladsl.Sink
 import akka.stream.scaladsl.Flow
 import akka.util.ByteString
+
 import whisk.common.TransactionId
 import whisk.core.containerpool.Container
 import whisk.core.entity.{ActivationLogs, ExecutableWhiskAction, Identity, 
WhiskActivation}
-import spray.json._
 import whisk.http.Messages
 
 import scala.concurrent.{ExecutionContext, Future}
 
+import spray.json._
+
 /**
  * Represents a single log line as read from a docker log
  */
@@ -64,7 +67,8 @@ class DockerToActivationLogStore(system: ActorSystem) extends 
LogStore {
   override val containerParameters = Map("--log-driver" -> Set("json-file"))
 
   /* As logs are already part of the activation record, just return that bit 
of it */
-  override def fetchLogs(activation: WhiskActivation): Future[ActivationLogs] 
= Future.successful(activation.logs)
+  override def fetchLogs(user: Identity, activation: WhiskActivation, request: 
HttpRequest): Future[ActivationLogs] =
+Future.successful(activation.logs)
 
   override def collectLogs(transid: TransactionId,
user: Identity,
diff --git 
a/common/scala/src/main/scala/whisk/core/containerpool/logging/LogDriverLogStore.scala
 
b/common/scala/src/main/scala/whisk/core/containerpool/logging/LogDriverLogStore.scala
index 465fb2532f..ea1576cc12 100644
--- 
a/common/scala/src/main/scala/whisk/core/containerpool/logging/LogDriverLogStore.scala
+++ 
b/common/scala/src/main/scala/whisk/core/containerpool/logging/LogDriverLogStore.scala
@@ -18,10 +18,12 @@
 package whisk.core.containerpool.logging
 
 import akka.actor.ActorSystem
+import akka.http.scaladsl.model.HttpRequest
+
 import whisk.core.entity.Identity
 import whisk.common.TransactionId
 import whisk.core.containerpool.Container
-import whisk.core.entity.{ActivationLogs, ExecutableWhiskAction, 
WhiskActivation}
+import whisk.core.entity.{ActivationLogs, ExecutableWhiskAction, Identity, 
WhiskActivation}
 
 import scala.concurrent.Future
 
@@ -47,7 +49,7 @@ class LogDriverLogStore(actorSystem: ActorSystem) extends 
LogStore {
 
   /** no logs exposed to API/CLI using only the LogDriverLogStore; use an 
extended version,
* e.g. the SplunkLogStore to expose logs from some external source */
-  def fetchLogs(activation: WhiskActivation): Future[ActivationLogs] =
+  def fetchLogs(user: Identity, activation: WhiskActivation, request: 
HttpRequest): Future[ActivationLogs] =
 Future.successful(ActivationLogs(Vector("Logs are not available.")))
 }
 
diff --git 
a/common/scala/src/main/scala/whisk/core/containerpool/logging/LogStore.scala 
b/common/scala/src/main/scala/whisk/core/containerpool/logging/LogStore.scala

[GitHub] csantanapr commented on issue #3314: Configure Gradle build scan plugin

2018-02-23 Thread GitBox
csantanapr commented on issue #3314: Configure Gradle build scan plugin
URL: 
https://github.com/apache/incubator-openwhisk/pull/3314#issuecomment-368115345
 
 
   Playground4/1390/ ? 


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


[GitHub] rabbah opened a new pull request #3336: Remove dead field.

2018-02-23 Thread GitBox
rabbah opened a new pull request #3336: Remove dead field.
URL: https://github.com/apache/incubator-openwhisk/pull/3336
 
 
   


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


[GitHub] akrabat commented on issue #3335: Allow container tests to run without a proxy.

2018-02-23 Thread GitBox
akrabat commented on issue #3335: Allow container tests to run without a proxy.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3335#issuecomment-368106033
 
 
   I copied the changed `ActionContainer.scala` file to my clone of 
incubator-openwhisk-runtime-php (Note that the package name is different in the 
version of this file in incubator-openwhisk-runtime-php?)
   
   The tests ran. See 
https://gist.github.com/akrabat/60c1a0d7cc9b7d4acdb0a64b7da81230


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


[GitHub] dubeejw commented on issue #3330: Update Log Store Fetch

2018-02-23 Thread GitBox
dubeejw commented on issue #3330: Update Log Store Fetch
URL: 
https://github.com/apache/incubator-openwhisk/pull/3330#issuecomment-368100274
 
 
   PG3 1908 ? 


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


[GitHub] markusthoemmes closed pull request #3219: Kubernetes ContainerFactoryProvider implementation

2018-02-23 Thread GitBox
markusthoemmes closed pull request #3219: Kubernetes ContainerFactoryProvider 
implementation
URL: https://github.com/apache/incubator-openwhisk/pull/3219
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/common/scala/build.gradle b/common/scala/build.gradle
index 1a44bcee68..8e0aeede68 100644
--- a/common/scala/build.gradle
+++ b/common/scala/build.gradle
@@ -41,6 +41,7 @@ dependencies {
 }
 compile 'com.github.ben-manes.caffeine:caffeine:2.4.0'
 compile 'com.google.code.findbugs:jsr305:3.0.2'
+compile 'io.fabric8:kubernetes-client:2.5.7'
 compile 'io.kamon:kamon-core_2.11:0.6.7'
 compile 'io.kamon:kamon-statsd_2.11:0.6.7'
 }
diff --git a/common/scala/src/main/scala/whisk/common/Logging.scala 
b/common/scala/src/main/scala/whisk/common/Logging.scala
index cce6b913f6..37cc1e3cc6 100644
--- a/common/scala/src/main/scala/whisk/common/Logging.scala
+++ b/common/scala/src/main/scala/whisk/common/Logging.scala
@@ -263,6 +263,7 @@ object LoggingMarkers {
   def INVOKER_RUNC_CMD(cmd: String) = LogMarkerToken(invoker, s"runc.$cmd", 
start)
   def INVOKER_CONTAINER_START(containerState: String) =
 LogMarkerToken(invoker, s"container_start_${containerState}", count)
+  def INVOKER_KUBECTL_CMD(cmd: String) = LogMarkerToken(invoker, 
s"kubectl.$cmd", start)
 
   /*
* General markers
diff --git a/common/scala/src/main/scala/whisk/core/WhiskConfig.scala 
b/common/scala/src/main/scala/whisk/core/WhiskConfig.scala
index 79c6d89003..aaa6a89aa9 100644
--- a/common/scala/src/main/scala/whisk/core/WhiskConfig.scala
+++ b/common/scala/src/main/scala/whisk/core/WhiskConfig.scala
@@ -256,6 +256,9 @@ object ConfigKeys {
   val containerFactory = "whisk.container-factory"
   val containerArgs = s"$containerFactory.container-args"
 
+  val kubernetes = "whisk.kubernetes"
+  val kubernetesTimeouts = s"$kubernetes.timeouts"
+
   val transactions = "whisk.transactions"
   val stride = s"$transactions.stride"
 
diff --git a/core/invoker/Dockerfile b/core/invoker/Dockerfile
index da3342990a..1bc2164e45 100644
--- a/core/invoker/Dockerfile
+++ b/core/invoker/Dockerfile
@@ -1,6 +1,9 @@
 FROM scala
 
 ENV DOCKER_VERSION 1.12.0
+ENV KUBERNETES_VERSION 1.6.4
+
+RUN apk add --update openssl
 
 # Uncomment to fetch latest version of docker instead: RUN wget -qO- 
https://get.docker.com | sh
 # Install docker client
@@ -11,6 +14,11 @@ rm -f docker-${DOCKER_VERSION}.tgz && \
 chmod +x /usr/bin/docker && \
 chmod +x /usr/bin/docker-runc
 
+# Install kubernetes client
+RUN wget --no-verbose 
https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl
 && \
+chmod +x kubectl && \
+mv kubectl /usr/bin/kubectl
+
 COPY build/distributions/invoker.tar ./
 RUN tar xf invoker.tar && \
 rm -f invoker.tar
@@ -19,4 +27,4 @@ COPY init.sh /
 RUN chmod +x init.sh
 
 EXPOSE 8080
-CMD ["init.sh", "0"]
\ No newline at end of file
+CMD ["init.sh", "0"]
diff --git a/core/invoker/src/main/resources/application.conf 
b/core/invoker/src/main/resources/application.conf
index 94620dd203..37d2f5ffa9 100644
--- a/core/invoker/src/main/resources/application.conf
+++ b/core/invoker/src/main/resources/application.conf
@@ -14,6 +14,14 @@ whisk {
 unpause: 10 seconds
   }
 
+  # Timeouts for k8s commands. Set to "Inf" to disable timeout.
+  kubernetes.timeouts {
+run: 1 minute
+rm: 1 minute
+inspect: 1 minute
+logs: 1 minute
+  }
+
   # Timeouts for runc commands. Set to "Inf" to disable timeout.
   runc.timeouts {
 pause: 10 seconds
@@ -27,4 +35,4 @@ whisk {
 extra-args: {}
 
   }
-}
\ No newline at end of file
+}
diff --git 
a/core/invoker/src/main/scala/whisk/core/containerpool/kubernetes/KubernetesClient.scala
 
b/core/invoker/src/main/scala/whisk/core/containerpool/kubernetes/KubernetesClient.scala
new file mode 100644
index 00..39155d1535
--- /dev/null
+++ 
b/core/invoker/src/main/scala/whisk/core/containerpool/kubernetes/KubernetesClient.scala
@@ -0,0 +1,380 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions 

[GitHub] rabbah commented on issue #3335: Allow container tests to run without a proxy.

2018-02-23 Thread GitBox
rabbah commented on issue #3335: Allow container tests to run without a proxy.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3335#issuecomment-368096873
 
 
   @csantanapr so all the runtime repos cloned and owned this code :)
   maybe the maven dep management being rolled out will help avoid touching all 
the repos.


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


[GitHub] rabbah commented on issue #3335: Allow container tests to run without a proxy.

2018-02-23 Thread GitBox
rabbah commented on issue #3335: Allow container tests to run without a proxy.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3335#issuecomment-368096873
 
 
   @csantanapr so all the runtime repos cloned and owned this code :)
   maybe the maven dep management being rolled out will help touching all the 
repos.


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


[GitHub] jonpspri opened a new pull request #229: Travis local cli

2018-02-23 Thread GitBox
jonpspri opened a new pull request #229: Travis local cli
URL: https://github.com/apache/incubator-openwhisk-cli/pull/229
 
 
   See https://github.com/apache/incubator-openwhisk/issues/3329
   
   These changes to the travis build script should cause it to exercise the CLI 
copy logic in the ansible scripts executing tests against OpenWhisk.


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


[GitHub] rabbah commented on issue #3335: Allow container tests to run without a proxy.

2018-02-23 Thread GitBox
rabbah commented on issue #3335: Allow container tests to run without a proxy.
URL: 
https://github.com/apache/incubator-openwhisk/pull/3335#issuecomment-368096873
 
 
   @csantanapr so all the runtime repos cloned and owned this code :)


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


[GitHub] kameshsampath commented on a change in pull request #97: Added maven archetype for Java Action

2018-02-23 Thread GitBox
kameshsampath commented on a change in pull request #97: Added maven archetype 
for Java Action
URL: 
https://github.com/apache/incubator-openwhisk-devtools/pull/97#discussion_r170316034
 
 

 ##
 File path: java-action-archetype/README.md
 ##
 @@ -0,0 +1,14 @@
+# Maven Archetype for Java Action
+
+This archetype helps to generate the JavaAction template project
 
 Review comment:
   maven required on the Host system where the developer or user will be 
developing it, added some pre-req to the README


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


[GitHub] kameshsampath commented on a change in pull request #97: Added maven archetype for Java Action

2018-02-23 Thread GitBox
kameshsampath commented on a change in pull request #97: Added maven archetype 
for Java Action
URL: 
https://github.com/apache/incubator-openwhisk-devtools/pull/97#discussion_r170315889
 
 

 ##
 File path: java-action-archetype/README.md
 ##
 @@ -0,0 +1,14 @@
+# Maven Archetype for Java Action
+
+This archetype helps to generate the JavaAction template project
+
+## Generate project 
+
+```sh
+mvn archetype:generate \
+  -DarchetypeGroupId=org.apache.openwhisk.java \
+  -DarchetypeArtifactId=java-action-archetype \
+  -DarchetypeVersion=1.0-SNAPSHOT \
+  -DgroupId=com.example \
+  -DartifactId=demo-function
+```
 
 Review comment:
   updated


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


[GitHub] jonpspri opened a new pull request #3334: Cli ansible fix

2018-02-23 Thread GitBox
jonpspri opened a new pull request #3334: Cli ansible fix
URL: https://github.com/apache/incubator-openwhisk/pull/3334
 
 
   Changes to ansible build so that it will work appropriately for local CLI 
build.  Assumption is 'incubator-openwhisk-cli' is in the same directory as 
'incubator-openwhisk'.  Also added environment variable `OPENWHISK_CLI_MODE` 
which will be checked if `cli_installation_mode` is not explicitly set for 
ansible.
   
   Changes to travis will follow; keeping the two areas separate for now.
   
   First of two fixes for #3329 
   
   P.S.  Sorry about the extra commits.  I appear to have gotten sloppy with my 
branches -- please squash when merging.


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


[GitHub] csantanapr commented on issue #3333: Make parameters with defined values final

2018-02-23 Thread GitBox
csantanapr commented on issue #: Make parameters with defined values final 
URL: 
https://github.com/apache/incubator-openwhisk/pull/#issuecomment-368065978
 
 
   PG?


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


[GitHub] dubeejw commented on issue #3330: Update Log Store Fetch

2018-02-23 Thread GitBox
dubeejw commented on issue #3330: Update Log Store Fetch
URL: 
https://github.com/apache/incubator-openwhisk/pull/3330#issuecomment-368062365
 
 
   @markusthoemmes, added a second commit that sends the HTTP request to the 
log store instead of just the HTTP headers.


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


[GitHub] houshengbo commented on issue #3: Use Apache Tentacles to create a LICENSE and NOTICE report

2018-02-23 Thread GitBox
houshengbo commented on issue #3: Use Apache Tentacles to create a LICENSE and 
NOTICE report
URL: 
https://github.com/apache/incubator-openwhisk-release/issues/3#issuecomment-368062626
 
 
   @daisy-ycguo I have tried the Tentacles to generate the report for our 
staging directory, I found all the license and notice report empty, even if I 
put LICENSE, LICENSES, LICENSE.txt and LICENSES.txt inside the tar.gz. 
   
   I am not sure what you have found out for our directory: 
https://dist.apache.org/repos/dist/dev/incubator/openwhisk/openwhisk-incubator-rc1/


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


[GitHub] houshengbo commented on issue #3: Use Apache Tentacles to create a LICENSE and NOTICE report

2018-02-23 Thread GitBox
houshengbo commented on issue #3: Use Apache Tentacles to create a LICENSE and 
NOTICE report
URL: 
https://github.com/apache/incubator-openwhisk-release/issues/3#issuecomment-368062626
 
 
   @daisy-ycguo I have tried the Tentacles to generate the report for our 
staging directory, I found all the license and notice report empty, even if I 
put LICENSE, LICENSES, LICENSE.txt and LICENSES.txt inside the tar.gz. 


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


[GitHub] dubeejw commented on issue #3330: Update Log Store Fetch

2018-02-23 Thread GitBox
dubeejw commented on issue #3330: Update Log Store Fetch
URL: 
https://github.com/apache/incubator-openwhisk/pull/3330#issuecomment-368062365
 
 
   @markusthoemmes, added a second commit that send the HTTP request to the log 
store instead of just the HTTP headers.


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


[GitHub] rabbah opened a new pull request #3333: Make parameters with defined values final

2018-02-23 Thread GitBox
rabbah opened a new pull request #: Make parameters with defined values 
final 
URL: https://github.com/apache/incubator-openwhisk/pull/
 
 
   Web actions can carry a final annotation which makes their parameters with 
predefined values immutable. This patch makes the same behavior applicable for 
a POST invoke as well.


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


[GitHub] ddragosd commented on a change in pull request #97: Added maven archetype for Java Action

2018-02-23 Thread GitBox
ddragosd commented on a change in pull request #97: Added maven archetype for 
Java Action
URL: 
https://github.com/apache/incubator-openwhisk-devtools/pull/97#discussion_r170294203
 
 

 ##
 File path: java-action-archetype/README.md
 ##
 @@ -0,0 +1,14 @@
+# Maven Archetype for Java Action
+
+This archetype helps to generate the JavaAction template project
 
 Review comment:
   can you try to go through the steps documented here on i.e. `docker run -ti 
--entrypoint bash openwhisk/invoker`  and see what's missing besides java 8 ?


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


[GitHub] ddragosd commented on a change in pull request #97: Added maven archetype for Java Action

2018-02-23 Thread GitBox
ddragosd commented on a change in pull request #97: Added maven archetype for 
Java Action
URL: 
https://github.com/apache/incubator-openwhisk-devtools/pull/97#discussion_r170291220
 
 

 ##
 File path: java-action-archetype/README.md
 ##
 @@ -0,0 +1,14 @@
+# Maven Archetype for Java Action
+
+This archetype helps to generate the JavaAction template project
+
+## Generate project 
+
+```sh
+mvn archetype:generate \
+  -DarchetypeGroupId=org.apache.openwhisk.java \
+  -DarchetypeArtifactId=java-action-archetype \
+  -DarchetypeVersion=1.0-SNAPSHOT \
+  -DgroupId=com.example \
+  -DartifactId=demo-function
+```
 
 Review comment:
   Can we also continue the readme with what to do afterwards, in order to test 
the action ? _explaining like I'm five_ ? 


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


[GitHub] lionelvillard commented on issue #98: ShortDesc name field is optional

2018-02-23 Thread GitBox
lionelvillard commented on issue #98: ShortDesc name field is optional
URL: 
https://github.com/apache/incubator-openwhisk-client-js/pull/98#issuecomment-368030566
 
 
   At least for `packages.update` the name argument is at the top-level. The 
one is `Package` is ignored. 


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


[GitHub] gbdrt commented on issue #98: ShortDesc name field is optional

2018-02-23 Thread GitBox
gbdrt commented on issue #98: ShortDesc name field is optional
URL: 
https://github.com/apache/incubator-openwhisk-client-js/pull/98#issuecomment-368025321
 
 
   LGTM.
   But what is the usecase where you don't need to provide a name?


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


[GitHub] csantanapr commented on a change in pull request #3332: Redo usage now requires 1+ components

2018-02-23 Thread GitBox
csantanapr commented on a change in pull request #3332: Redo usage now requires 
1+ components
URL: 
https://github.com/apache/incubator-openwhisk/pull/3332#discussion_r170259864
 
 

 ##
 File path: tools/build/redo
 ##
 @@ -94,7 +94,7 @@ def getArgs():
 parser.add_argument('-n', '--just-print', help='prints the component 
configuration but does not run any targets', action='store_const', const=True, 
default=False, dest='skiprun')
 parser.add_argument('-c', '--list-components', help='list known component 
names and exit', action='store_const', const=True, default=False, dest='list')
 parser.add_argument('-a', '--additional-task-arguments', dest='extraArgs', 
action='append', help='pass additional arguments to underlying task command')
-parser.add_argument('components', nargs = '*', help='component name(s) to 
run (in order specified if more than one)')
+parser.add_argument('components', nargs = '+', help='component name(s) to 
run (in order specified if more than one)')
 
 Review comment:
   What is this python voodo magic @rabbah ?


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


[GitHub] jonpspri opened a new pull request #3332: Redo usage now requires 1+ components

2018-02-23 Thread GitBox
jonpspri opened a new pull request #3332: Redo usage now requires 1+ components
URL: https://github.com/apache/incubator-openwhisk/pull/3332
 
 
   Found this while testing for the CLI usage issue.  Redo used to print a 
'usage' with component showing as optional when it is in fact mandatory to 
provide at least one component.  This fixes that problem to make the user's 
error in typing just './redo' apparent.


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


[GitHub] markusthoemmes closed pull request #3272: improve loadbalancer's schedule algorithm

2018-02-23 Thread GitBox
markusthoemmes closed pull request #3272: improve loadbalancer's schedule 
algorithm
URL: https://github.com/apache/incubator-openwhisk/pull/3272
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala
 
b/core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala
index 193ed8da9f..a5327b0907 100644
--- 
a/core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala
+++ 
b/core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala
@@ -18,6 +18,7 @@
 package whisk.core.loadBalancer
 
 import java.nio.charset.StandardCharsets
+import java.util.concurrent.ThreadLocalRandom
 
 import akka.actor.{ActorSystem, Props}
 import akka.cluster.Cluster
@@ -343,7 +344,11 @@ object ContainerPoolBalancer extends LoadBalancerProvider {
 .find(_._3 < invokerBusyThreshold)
 .orElse(invokerProgression.find(_._3 < invokerBusyThreshold * 2))
 .orElse(invokerProgression.find(_._3 < invokerBusyThreshold * 3))
-.orElse(invokerProgression.headOption)
+.orElse(
+  if (invokerProgression.isEmpty)
+None
+  else
+
Some(invokerProgression(ThreadLocalRandom.current().nextInt(invokerProgression.size
 .map(_._1)
 } else None
   }
diff --git 
a/tests/src/test/scala/whisk/core/loadBalancer/test/ContainerPoolBalancerObjectTests.scala
 
b/tests/src/test/scala/whisk/core/loadBalancer/test/ContainerPoolBalancerObjectTests.scala
index 60eda84a79..fd3252d1c8 100644
--- 
a/tests/src/test/scala/whisk/core/loadBalancer/test/ContainerPoolBalancerObjectTests.scala
+++ 
b/tests/src/test/scala/whisk/core/loadBalancer/test/ContainerPoolBalancerObjectTests.scala
@@ -143,11 +143,14 @@ class ContainerPoolBalancerObjectTests extends FlatSpec 
with Matchers {
 ContainerPoolBalancer.schedule(invs, 16, hash) shouldBe Some(InstanceId(0))
   }
 
-  it should "choose the home invoker if all invokers are overloaded even above 
the muliplied threshold" in {
-val invs = IndexedSeq((InstanceId(0), Healthy, 51), (InstanceId(1), 
Healthy, 50), (InstanceId(2), Healthy, 49))
-val hash = 0 // home is 0, stepsize is 1
-
-ContainerPoolBalancer.schedule(invs, 16, hash) shouldBe Some(InstanceId(0))
+  it should "choose the random invoker if all invokers are overloaded even 
above the muliplied threshold" in {
+val invs = IndexedSeq((InstanceId(0), Healthy, 33), (InstanceId(1), 
Healthy, 33), (InstanceId(2), Healthy, 33))
+val invokerBusyThreshold = 11
+val hash = 0
+val bruteResult = (0 to 100) map { _ =>
+  ContainerPoolBalancer.schedule(invs, invokerBusyThreshold, 
hash).get.toInt
+}
+bruteResult should contain allOf (0, 1, 2)
   }
 
   it should "transparently work with partitioned sets of invokers" in {


 


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