openwhisk-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-openwhisk] markusthoemmes commented on a change in pull request #4570: KCF: propagate cf_ca_extraArgs_env_i into user containers
Date Thu, 25 Jul 2019 22:42:55 GMT
markusthoemmes commented on a change in pull request #4570: KCF: propagate cf_ca_extraArgs_env_i
into user containers
URL: https://github.com/apache/incubator-openwhisk/pull/4570#discussion_r307528267
 
 

 ##########
 File path: core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesContainerFactory.scala
 ##########
 @@ -40,12 +41,25 @@ import org.apache.openwhisk.core.{ConfigKeys, WhiskConfig}
 class KubernetesContainerFactory(
   label: String,
   config: WhiskConfig,
+  containerArgsConfig: ContainerArgsConfig = loadConfigOrThrow[ContainerArgsConfig](ConfigKeys.containerArgs),
   runtimesRegistryConfig: RuntimesRegistryConfig = loadConfigOrThrow[RuntimesRegistryConfig](
     ConfigKeys.runtimesRegistry))(implicit actorSystem: ActorSystem, ec: ExecutionContext,
logging: Logging)
     extends ContainerFactory {
 
   implicit val kubernetes = initializeKubeClient()
 
+  val augmentedEnv: Map[String, String] = {
+    val envArgs = containerArgsConfig.extraArgs.filter((t) => t._1.equals("env")).values
+    envArgs
+      .flatMap(
+        _.filter(_.contains("="))
+          .map(x => {
+            val tmp = x.split("=")
 
 Review comment:
   You can make use of flatMap to fold this map and the filter into one operation I think:
   
   ```scala
   val envArgs = ...getOrElse("env", Set.empty[String])
   envArgs
     .flatMap(_.split("=") match {
       case Array(key, value) => Some(key -> value)
       case _ => None
     }.toMap
   ```

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


With regards,
Apache Git Services

Mime
View raw message