ningyougang commented on a change in pull request #4790: [WIP]Config runtime
URL: https://github.com/apache/openwhisk/pull/4790#discussion_r363580358
##########
File path:
core/controller/src/main/scala/org/apache/openwhisk/core/controller/Controller.scala
##########
@@ -163,6 +164,65 @@ class Controller(val instance: ControllerInstanceId,
LogLimit.config,
runtimes,
List(apiV1.basepath()))
+
+ private val controllerUsername = {
+ val source = scala.io.Source.fromFile("/conf/controllerauth.username");
+ try source.mkString.replaceAll("\r|\n", "")
+ finally source.close()
+ }
+ private val controllerPassword = {
+ val source = scala.io.Source.fromFile("/conf/controllerauth.password");
+ try source.mkString.replaceAll("\r|\n", "")
+ finally source.close()
+ }
+
+ /**
+ * config runtime
+ */
+ private val configRuntime = {
+ implicit val executionContext = actorSystem.dispatcher
+ (path("config" / "runtime") & post) {
+ extractCredentials {
+ case Some(BasicHttpCredentials(username, password)) =>
+ if (username == controllerUsername && password ==
controllerPassword) {
+ entity(as[String]) { runtime =>
+ val execManifest = ExecManifest.initialize(runtime)
+ if (execManifest.isFailure) {
+ logging.error(this, s"Received invalid runtimes manifest")
+ complete(s"Received invalid runtimes manifest")
+ } else {
+ parameter('limit.?) { limit =>
Review comment:
Support passed limit invokers, e.g. `?limit=0:1` (invoker0, invoker1)
And the config runtime request can be sent to some limited invokers which
included in managed invokers as well.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services