You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by dg...@apache.org on 2018/03/07 19:50:13 UTC

[incubator-openwhisk] branch master updated: Remove namespace configuration; use invoker's instead (#3409)

This is an automated email from the ASF dual-hosted git repository.

dgrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 38b8062  Remove namespace configuration; use invoker's instead (#3409)
38b8062 is described below

commit 38b8062c9ce607183e0decda2e3ba307ad690cc3
Author: Jim Crossley <ji...@crossleys.org>
AuthorDate: Wed Mar 7 14:50:09 2018 -0500

    Remove namespace configuration; use invoker's instead (#3409)
    
    Making this configurable -- and defaulting to something that may not
    be the ns in which the invoker is running -- is more trouble than it's
    worth, I think.
---
 core/invoker/src/main/resources/application.conf              |  1 -
 .../core/containerpool/kubernetes/KubernetesClient.scala      | 11 +++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/core/invoker/src/main/resources/application.conf b/core/invoker/src/main/resources/application.conf
index 7f85eb5..bc651fc 100644
--- a/core/invoker/src/main/resources/application.conf
+++ b/core/invoker/src/main/resources/application.conf
@@ -19,7 +19,6 @@ whisk {
   }
 
   kubernetes {
-    namespace: openwhisk
     # Timeouts for k8s commands. Set to "Inf" to disable timeout.
     timeouts {
       run: 1 minute
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
index 5f7c7d6..6853f66 100644
--- a/core/invoker/src/main/scala/whisk/core/containerpool/kubernetes/KubernetesClient.scala
+++ b/core/invoker/src/main/scala/whisk/core/containerpool/kubernetes/KubernetesClient.scala
@@ -79,9 +79,7 @@ case class KubernetesInvokerAgentConfig(enabled: Boolean, port: Int)
 /**
  * General configuration for kubernetes client
  */
-case class KubernetesClientConfig(namespace: String,
-                                  timeouts: KubernetesClientTimeoutConfig,
-                                  invokerAgent: KubernetesInvokerAgentConfig)
+case class KubernetesClientConfig(timeouts: KubernetesClientTimeoutConfig, invokerAgent: KubernetesInvokerAgentConfig)
 
 /**
  * Serves as interface to the kubectl CLI tool.
@@ -150,12 +148,13 @@ class KubernetesClient(
       .endSpec()
       .build()
 
-    kubeRestClient.pods.inNamespace(config.namespace).create(pod)
+    val namespace = kubeRestClient.getNamespace
+    kubeRestClient.pods.inNamespace(namespace).create(pod)
 
     Future {
       blocking {
         val createdPod = kubeRestClient.pods
-          .inNamespace(config.namespace)
+          .inNamespace(namespace)
           .withName(name)
           .waitUntilReady(config.timeouts.run.length, config.timeouts.run.unit)
         toContainer(createdPod)
@@ -178,7 +177,7 @@ class KubernetesClient(
       Future {
         blocking {
           kubeRestClient
-            .inNamespace(config.namespace)
+            .inNamespace(kubeRestClient.getNamespace)
             .pods()
             .withLabel(key, value)
             .list()

-- 
To stop receiving notification emails like this one, please contact
dgrove@apache.org.