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

pdallig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/master by this push:
     new 503ae3b  [ZEPPELIN-5442] Allow users to set a separate namespace for 
the interpreter
503ae3b is described below

commit 503ae3be6fcb911ea71156c4c6a9805d52549899
Author: rick <[email protected]>
AuthorDate: Mon Jul 12 16:49:38 2021 +0800

    [ZEPPELIN-5442] Allow users to set a separate namespace for the interpreter
    
    ### What is this PR for?
    Currently, if zeppelin is running under k8s mode and the zeppelin server is 
running inside the k8s cluster, it will start the interpreter pod under the 
namespace specified in 
`/var/run/secrets/kubernetes.io/serviceaccount/namespace`. But if 
zeppelin-server is running **outside of kubernetes cluster**, it will use the 
config `zeppelin.k8s.namespace` to start the interpreter pod under the given 
namespace. However, this approach will cause users to only set a **global 
namespace**.
    
    Hence, this PR allows user to set a set **separate namespace** for the 
interpreter in the interpreter settings:
    
    Example usage:
    ```
    %spark.conf
    zeppelin.k8s.interpreter.namespace spark
    ```
    The spark interpreter pod will be created under the namespace: `spark`.
    
    ```
    %python.conf
    zeppelin.k8s.interpreter.namespace python
    ```
    The python interpreter pod will be created under the namespace: `python`.
    
    ### What type of PR is it?
    [Improvement]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    * <https://issues.apache.org/jira/browse/ZEPPELIN-5442>
    
    ### How should this be tested?
    * CI pass and manually tested
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: rick <[email protected]>
    
    Closes #4174 from rickchengx/ZEPPELIN-5442 and squashes the following 
commits:
    
    a68956add [rick] [ZEPPELIN-5442] Allow users to set a separate namespace 
for the interpreter
---
 docs/quickstart/kubernetes.md                      |  2 +-
 k8s/interpreter/100-interpreter-spec.yaml          |  6 +-
 k8s/zeppelin-server.yaml                           |  5 +-
 .../launcher/K8sRemoteInterpreterProcess.java      | 35 +++++++-----
 .../launcher/K8sStandardInterpreterLauncher.java   | 42 ++------------
 .../zeppelin/interpreter/launcher/K8sUtils.java    | 65 ++++++++++++++++++++++
 .../launcher/K8sRemoteInterpreterProcessTest.java  | 12 ++--
 7 files changed, 103 insertions(+), 64 deletions(-)

diff --git a/docs/quickstart/kubernetes.md b/docs/quickstart/kubernetes.md
index f82d471..8d311fb 100644
--- a/docs/quickstart/kubernetes.md
+++ b/docs/quickstart/kubernetes.md
@@ -248,7 +248,7 @@ The interpreter pod can also be customized through the 
interpreter settings. Her
 
 | Property Name | Default Value | Description |
 | ----- | ----- | ----- |
-| `zeppelin.k8s.namespace` | `default` | The Kubernetes namespace to use. |
+| `zeppelin.k8s.interpreter.namespace` | `default` | Specify the namespace of 
the current interpreter. Users can set different namespaces for different 
interpreters. In order to minimize permissions, the interpreter pod can only be 
created in the `default` namespace by default. If users need to create an 
interpreter pod in other namespaces, they need to add the corresponding 
`rolebinding` in `k8s/zeppelin-server.yaml`.|
 | `zeppelin.k8s.interpreter.serviceAccount` | `default` | The Kubernetes 
service account to use. |
 | `zeppelin.k8s.interpreter.container.image` | 
`apache/zeppelin:<ZEPPELIN_VERSION>` | The interpreter image to use. |
 | `zeppelin.k8s.interpreter.cores` | (optional)  | The number of cpu cores to 
use. |
diff --git a/k8s/interpreter/100-interpreter-spec.yaml 
b/k8s/interpreter/100-interpreter-spec.yaml
index 3b27ad5..8303f9c 100644
--- a/k8s/interpreter/100-interpreter-spec.yaml
+++ b/k8s/interpreter/100-interpreter-spec.yaml
@@ -17,7 +17,7 @@
 kind: Pod
 apiVersion: v1
 metadata:
-  namespace: {{zeppelin.k8s.namespace}}
+  namespace: {{zeppelin.k8s.interpreter.namespace}}
   name: {{zeppelin.k8s.interpreter.pod.name}}
   labels:
     app: {{zeppelin.k8s.interpreter.pod.name}}
@@ -114,7 +114,7 @@ spec:
 kind: Service
 apiVersion: v1
 metadata:
-  namespace: {{zeppelin.k8s.namespace}}
+  namespace: {{zeppelin.k8s.interpreter.namespace}}
   name: {{zeppelin.k8s.interpreter.pod.name}}             # keep Service name 
the same to Pod name.
   {% if zeppelin.k8s.server.uid is defined %}
   ownerReferences:
@@ -146,7 +146,7 @@ kind: Role
 apiVersion: rbac.authorization.k8s.io/v1
 metadata:
   name: {{zeppelin.k8s.interpreter.pod.name}}
-  namespace: {{zeppelin.k8s.namespace}}
+  namespace: {{zeppelin.k8s.interpreter.namespace}}
   {% if zeppelin.k8s.server.uid is defined %}
   ownerReferences:
   - apiVersion: v1
diff --git a/k8s/zeppelin-server.yaml b/k8s/zeppelin-server.yaml
index 2988b6f..afd7423 100644
--- a/k8s/zeppelin-server.yaml
+++ b/k8s/zeppelin-server.yaml
@@ -201,7 +201,7 @@ kind: ServiceAccount
 metadata:
   name: zeppelin-server
 ---
-kind: Role
+kind: ClusterRole
 apiVersion: rbac.authorization.k8s.io/v1
 metadata:
   name: zeppelin-server-role
@@ -217,10 +217,11 @@ kind: RoleBinding
 apiVersion: rbac.authorization.k8s.io/v1
 metadata:
   name: zeppelin-server-role-binding
+  namespace: default
 subjects:
 - kind: ServiceAccount
   name: zeppelin-server
 roleRef:
-  kind: Role
+  kind: ClusterRole
   name: zeppelin-server-role
   apiGroup: rbac.authorization.k8s.io
diff --git 
a/zeppelin-plugins/launcher/k8s-standard/src/main/java/org/apache/zeppelin/interpreter/launcher/K8sRemoteInterpreterProcess.java
 
b/zeppelin-plugins/launcher/k8s-standard/src/main/java/org/apache/zeppelin/interpreter/launcher/K8sRemoteInterpreterProcess.java
index 09f4999..87500fb 100644
--- 
a/zeppelin-plugins/launcher/k8s-standard/src/main/java/org/apache/zeppelin/interpreter/launcher/K8sRemoteInterpreterProcess.java
+++ 
b/zeppelin-plugins/launcher/k8s-standard/src/main/java/org/apache/zeppelin/interpreter/launcher/K8sRemoteInterpreterProcess.java
@@ -55,7 +55,7 @@ public class K8sRemoteInterpreterProcess extends 
RemoteInterpreterManagedProcess
   private static final Logger LOGGER = 
LoggerFactory.getLogger(K8sRemoteInterpreterProcess.class);
   private static final int K8S_INTERPRETER_SERVICE_PORT = 12321;
   private final KubernetesClient client;
-  private final String namespace;
+  private final String interpreterNamespace;
   private final String interpreterGroupName;
   private final File specTemplates;
   private final String containerImage;
@@ -81,7 +81,7 @@ public class K8sRemoteInterpreterProcess extends 
RemoteInterpreterManagedProcess
 
   public K8sRemoteInterpreterProcess(
           KubernetesClient client,
-          String namespace,
+          String interpreterNamespace,
           File specTemplates,
           String containerImage,
           String interpreterGroupId,
@@ -110,7 +110,7 @@ public class K8sRemoteInterpreterProcess extends 
RemoteInterpreterManagedProcess
           interpreterGroupId,
           isUserImpersonatedForSpark);
     this.client = client;
-    this.namespace = namespace;
+    this.interpreterNamespace = interpreterNamespace;
     this.specTemplates = specTemplates;
     this.containerImage = containerImage;
     this.interpreterGroupName = interpreterGroupName;
@@ -132,8 +132,8 @@ public class K8sRemoteInterpreterProcess extends 
RemoteInterpreterManagedProcess
   /**
    * @return Get namespace
    */
-  public String getNamespace() {
-    return namespace;
+  public String getInterpreterNamespace() {
+    return interpreterNamespace;
   }
 
   /**
@@ -161,7 +161,7 @@ public class K8sRemoteInterpreterProcess extends 
RemoteInterpreterManagedProcess
       // WATCH
       PodPhaseWatcher podWatcher = new PodPhaseWatcher(
           phase -> StringUtils.equalsAnyIgnoreCase(phase, "Succeeded", 
"Failed", "Running"));
-      try (Watch watch = 
client.pods().inNamespace(namespace).withName(podName).watch(podWatcher)) {
+      try (Watch watch = 
client.pods().inNamespace(interpreterNamespace).withName(podName).watch(podWatcher))
 {
         podWatcher.getCountDownLatch().await();
       } catch (InterruptedException e) {
         LOGGER.error("Interrupt received during waiting for Running phase. Try 
to stop the interpreter and interrupt the current thread.", e);
@@ -200,7 +200,7 @@ public class K8sRemoteInterpreterProcess extends 
RemoteInterpreterManagedProcess
     super.stop();
     // WATCH for soft shutdown
     PodPhaseWatcher podWatcher = new PodPhaseWatcher(phase -> 
StringUtils.equalsAny(phase, "Succeeded", "Failed"));
-    try (Watch watch = 
client.pods().inNamespace(namespace).withName(podName).watch(podWatcher)) {
+    try (Watch watch = 
client.pods().inNamespace(interpreterNamespace).withName(podName).watch(podWatcher))
 {
       if 
(!podWatcher.getCountDownLatch().await(RemoteInterpreterServer.DEFAULT_SHUTDOWN_TIMEOUT
 + 500L,
           TimeUnit.MILLISECONDS)) {
         LOGGER.warn("Pod {} doesn't terminate in time", podName);
@@ -234,7 +234,7 @@ public class K8sRemoteInterpreterProcess extends 
RemoteInterpreterManagedProcess
 
   public String getPodPhase() {
     try {
-      Pod pod = client.pods().inNamespace(namespace).withName(podName).get();
+      Pod pod = 
client.pods().inNamespace(interpreterNamespace).withName(podName).get();
       if (pod != null) {
         PodStatus status = pod.getStatus();
         if (status != null) {
@@ -276,9 +276,9 @@ public class K8sRemoteInterpreterProcess extends 
RemoteInterpreterManagedProcess
       LOGGER.info("Apply {} with {} K8s Objects", path.getAbsolutePath(), 
k8sObjects.get().size());
       LOGGER.debug(template);
       if (delete) {
-        k8sObjects.inNamespace(namespace).delete();
+        k8sObjects.inNamespace(interpreterNamespace).delete();
       } else {
-        k8sObjects.inNamespace(namespace).createOrReplace();
+        k8sObjects.inNamespace(interpreterNamespace).createOrReplace();
       }
     } else {
       LOGGER.error("Can't apply {}", path.getAbsolutePath());
@@ -290,7 +290,7 @@ public class K8sRemoteInterpreterProcess extends 
RemoteInterpreterManagedProcess
     Properties k8sProperties = new Properties();
 
     // k8s template properties
-    k8sProperties.put("zeppelin.k8s.namespace", getNamespace());
+    k8sProperties.put("zeppelin.k8s.interpreter.namespace", 
getInterpreterNamespace());
     k8sProperties.put("zeppelin.k8s.interpreter.pod.name", getPodName());
     k8sProperties.put("zeppelin.k8s.interpreter.serviceAccount", 
getServiceAccount());
     k8sProperties.put("zeppelin.k8s.interpreter.container.name", 
interpreterGroupName.toLowerCase());
@@ -302,10 +302,15 @@ public class K8sRemoteInterpreterProcess extends 
RemoteInterpreterManagedProcess
     k8sProperties.put("zeppelin.k8s.interpreter.rpc.portRange", 
getInterpreterPortRange());
     k8sProperties.put("zeppelin.k8s.server.rpc.service", intpEventServerHost);
     k8sProperties.put("zeppelin.k8s.server.rpc.portRange", 
intpEventServerPort);
-    if (ownerUID() != null && ownerName() != null) {
+
+    String serverNamespace = K8sUtils.getCurrentK8sNamespace();
+    String interpreterNamespace = getInterpreterNamespace();
+    //Set the owner reference (zeppelin-server pod) for garbage collection 
when zeppelin server and the zeppelin interpreter is in the same namespace 
(Kubernetes cannot specify an owner in different namespace).
+    if (ownerUID() != null && ownerName() != null && 
StringUtils.equals(serverNamespace, interpreterNamespace)) {
       k8sProperties.put("zeppelin.k8s.server.uid", ownerUID());
       k8sProperties.put("zeppelin.k8s.server.pod.name", ownerName());
     }
+    
     Map<String, String> k8sEnv = new HashMap<>(getEnv());
     // environment variables
     k8sEnv.put(ENV_SERVICE_DOMAIN, getEnv().getOrDefault(ENV_SERVICE_DOMAIN, 
System.getenv(ENV_SERVICE_DOMAIN) == null ? "local.zeppelin-project.org" : 
System.getenv(ENV_SERVICE_DOMAIN)));
@@ -409,7 +414,7 @@ public class K8sRemoteInterpreterProcess extends 
RemoteInterpreterManagedProcess
     if (isUserImpersonated() && !StringUtils.containsIgnoreCase(userName, 
"anonymous")) {
       options.append(" --proxy-user ").append(userName);
     }
-    options.append(" --conf 
spark.kubernetes.namespace=").append(getNamespace());
+    options.append(" --conf 
spark.kubernetes.namespace=").append(getInterpreterNamespace());
     options.append(" --conf spark.executor.instances=1");
     options.append(" --conf 
spark.kubernetes.driver.pod.name=").append(getPodName());
     String sparkContainerImage = properties.containsKey(SPARK_CONTAINER_IMAGE) 
? properties.getProperty(SPARK_CONTAINER_IMAGE) : sparkImage;
@@ -425,7 +430,7 @@ public class K8sRemoteInterpreterProcess extends 
RemoteInterpreterManagedProcess
   private String getInterpreterPodDnsName() {
     return String.format("%s.%s.svc",
         getPodName(), // service name and pod name is the same
-        getNamespace());
+        getInterpreterNamespace());
   }
 
   /**
@@ -465,7 +470,7 @@ public class K8sRemoteInterpreterProcess extends 
RemoteInterpreterManagedProcess
       LOGGER.info("Starting Port Forwarding");
       try {
         int localForwardedPodPort = 
RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces();
-        localPortForward = 
client.pods().inNamespace(namespace).withName(podName)
+        localPortForward = 
client.pods().inNamespace(interpreterNamespace).withName(podName)
             .portForward(K8S_INTERPRETER_SERVICE_PORT, localForwardedPodPort);
         super.processStarted(localForwardedPodPort, "localhost");
       } catch (IOException e) {
diff --git 
a/zeppelin-plugins/launcher/k8s-standard/src/main/java/org/apache/zeppelin/interpreter/launcher/K8sStandardInterpreterLauncher.java
 
b/zeppelin-plugins/launcher/k8s-standard/src/main/java/org/apache/zeppelin/interpreter/launcher/K8sStandardInterpreterLauncher.java
index aec68b7..d8f2b72 100644
--- 
a/zeppelin-plugins/launcher/k8s-standard/src/main/java/org/apache/zeppelin/interpreter/launcher/K8sStandardInterpreterLauncher.java
+++ 
b/zeppelin-plugins/launcher/k8s-standard/src/main/java/org/apache/zeppelin/interpreter/launcher/K8sStandardInterpreterLauncher.java
@@ -21,9 +21,6 @@ import java.io.File;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -33,7 +30,6 @@ import 
org.apache.zeppelin.interpreter.remote.RemoteInterpreterUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import io.fabric8.kubernetes.client.Config;
 import io.fabric8.kubernetes.client.DefaultKubernetesClient;
 import io.fabric8.kubernetes.client.KubernetesClient;
 
@@ -50,32 +46,6 @@ public class K8sStandardInterpreterLauncher extends 
InterpreterLauncher {
     client = new DefaultKubernetesClient();
   }
 
-  /**
-   * Check if i'm running inside of kubernetes or not.
-   * It should return truth regardless of ZeppelinConfiguration.getRunMode().
-   *
-   * Normally, unless Zeppelin is running on Kubernetes, 
K8sStandardInterpreterLauncher shouldn't even have initialized.
-   * However, when ZeppelinConfiguration.getRunMode() is force 'k8s', 
InterpreterSetting.getLauncherPlugin() will try
-   * to use K8sStandardInterpreterLauncher. This is useful for development. It 
allows Zeppelin server running on your
-   * IDE and creates your interpreters in Kubernetes. So any code changes on 
Zeppelin server or kubernetes yaml spec
-   * can be applied without re-building docker image.
-   * @return true, if running on K8s
-   */
-  boolean isRunningOnKubernetes() {
-    return new File(Config.KUBERNETES_NAMESPACE_PATH).exists();
-  }
-
-  /**
-   * Get current namespace
-   * @throws IOException if namespace file could not be read
-   */
-  String getNamespace() throws IOException {
-    if (isRunningOnKubernetes()) {
-      return readFile(Config.KUBERNETES_NAMESPACE_PATH, 
Charset.defaultCharset()).trim();
-    } else {
-      return zConf.getK8sNamepsace();
-    }
-  }
 
   /**
    * @return Get hostname. It should be the same to Service name (and Pod 
name) of the Kubernetes or
@@ -94,10 +64,12 @@ public class K8sStandardInterpreterLauncher extends 
InterpreterLauncher {
    * @throws IOException if the Zeppelin service cannot be generated
    */
   private String getZeppelinService(InterpreterLaunchContext context) throws 
IOException {
-    if (isRunningOnKubernetes()) {
+    if (K8sUtils.isRunningOnKubernetes()) {
+      //The namespace of zeppelin server can only be read from 
Config.KUBERNETES_NAMESPACE_PATH while it runs in k8s cluster, it may be 
different from the namespace of interpreter
+      String serverNamespace = K8sUtils.getCurrentK8sNamespace();
       return String.format("%s.%s.svc",
               zConf.getK8sServiceName(),
-              getNamespace());
+              serverNamespace);
     } else {
       return context.getIntpEventServerHost();
     }
@@ -136,7 +108,7 @@ public class K8sStandardInterpreterLauncher extends 
InterpreterLauncher {
 
     return new K8sRemoteInterpreterProcess(
             client,
-            getNamespace(),
+            K8sUtils.getInterpreterNamespace(properties, zConf),
             new File(zConf.getK8sTemplatesDir(), "interpreter"),
             zConf.getK8sContainerImage(),
             context.getInterpreterGroupId(),
@@ -171,8 +143,4 @@ public class K8sStandardInterpreterLauncher extends 
InterpreterLauncher {
     return env;
   }
 
-  private String readFile(String path, Charset encoding) throws IOException {
-    byte[] encoded = Files.readAllBytes(Paths.get(path));
-    return new String(encoded, encoding);
-  }
 }
diff --git 
a/zeppelin-plugins/launcher/k8s-standard/src/main/java/org/apache/zeppelin/interpreter/launcher/K8sUtils.java
 
b/zeppelin-plugins/launcher/k8s-standard/src/main/java/org/apache/zeppelin/interpreter/launcher/K8sUtils.java
index dd0e05f..6c155de 100644
--- 
a/zeppelin-plugins/launcher/k8s-standard/src/main/java/org/apache/zeppelin/interpreter/launcher/K8sUtils.java
+++ 
b/zeppelin-plugins/launcher/k8s-standard/src/main/java/org/apache/zeppelin/interpreter/launcher/K8sUtils.java
@@ -18,10 +18,18 @@
 
 package org.apache.zeppelin.interpreter.launcher;
 
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import io.fabric8.kubernetes.client.Config;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.zeppelin.conf.ZeppelinConfiguration;
 
 public class K8sUtils {
 
@@ -74,4 +82,61 @@ public class K8sUtils {
     }
     return memoryAmountBytes;
   }
+
+  /**
+   * return the current namespace
+   * @return the namespace in Config.KUBERNETES_NAMESPACE_PATH if it is 
running inside k8s, otherwise return null
+   */
+  public static String getCurrentK8sNamespace() {
+    try {
+      if (isRunningOnKubernetes()) {
+        return readFile(Config.KUBERNETES_NAMESPACE_PATH, 
Charset.defaultCharset()).trim();
+      } else {
+        return null;
+      }
+    }
+    catch (IOException e){
+      return null;
+    }
+  }
+
+  /**
+   * Get the namespace of the interpreter.
+   * Check Order: zeppelin.k8s.interpreter.namespace -> 
getCurrentK8sNamespace() -> zConf.getK8sNamepsace()
+   * @param properties
+   * @param zConf
+   * @return the interpreter namespace
+   * @throws IOException
+   */
+  public static String getInterpreterNamespace(Properties properties, 
ZeppelinConfiguration zConf) throws IOException {
+    if(properties.containsKey("zeppelin.k8s.interpreter.namespace")){
+      return properties.getProperty("zeppelin.k8s.interpreter.namespace");
+    }
+
+    if (isRunningOnKubernetes()) {
+      return getCurrentK8sNamespace();
+    } else {
+      return zConf.getK8sNamepsace();
+    }
+  }
+
+  /**
+   * Check if i'm running inside of kubernetes or not.
+   * It should return truth regardless of ZeppelinConfiguration.getRunMode().
+   *
+   * Normally, unless Zeppelin is running on Kubernetes, 
K8sStandardInterpreterLauncher shouldn't even have initialized.
+   * However, when ZeppelinConfiguration.getRunMode() is force 'k8s', 
InterpreterSetting.getLauncherPlugin() will try
+   * to use K8sStandardInterpreterLauncher. This is useful for development. It 
allows Zeppelin server running on your
+   * IDE and creates your interpreters in Kubernetes. So any code changes on 
Zeppelin server or kubernetes yaml spec
+   * can be applied without re-building docker image.
+   * @return true, if running on K8s
+   */
+  public static boolean isRunningOnKubernetes() {
+    return new File(Config.KUBERNETES_NAMESPACE_PATH).exists();
+  }
+
+  private static String readFile(String path, Charset encoding) throws 
IOException {
+    byte[] encoded = Files.readAllBytes(Paths.get(path));
+    return new String(encoded, encoding);
+  }
 }
diff --git 
a/zeppelin-plugins/launcher/k8s-standard/src/test/java/org/apache/zeppelin/interpreter/launcher/K8sRemoteInterpreterProcessTest.java
 
b/zeppelin-plugins/launcher/k8s-standard/src/test/java/org/apache/zeppelin/interpreter/launcher/K8sRemoteInterpreterProcessTest.java
index eafad5a..d6bd04c 100644
--- 
a/zeppelin-plugins/launcher/k8s-standard/src/test/java/org/apache/zeppelin/interpreter/launcher/K8sRemoteInterpreterProcessTest.java
+++ 
b/zeppelin-plugins/launcher/k8s-standard/src/test/java/org/apache/zeppelin/interpreter/launcher/K8sRemoteInterpreterProcessTest.java
@@ -112,7 +112,7 @@ public class K8sRemoteInterpreterProcessTest {
     Properties p = intp.getTemplateBindings(null);
 
     // then
-    assertEquals("default", p.get("zeppelin.k8s.namespace"));
+    assertEquals("default", p.get("zeppelin.k8s.interpreter.namespace"));
     assertEquals(intp.getPodName(), 
p.get("zeppelin.k8s.interpreter.pod.name"));
     assertEquals("sh", p.get("zeppelin.k8s.interpreter.container.name"));
     assertEquals("interpreter-container:1.0", 
p.get("zeppelin.k8s.interpreter.container.image"));
@@ -424,7 +424,7 @@ public class K8sRemoteInterpreterProcessTest {
         true);
     ExecutorService service = Executors.newFixedThreadPool(1);
     service
-        .submit(new PodStatusSimulator(server.getClient(), 
intp.getNamespace(), intp.getPodName(), intp));
+        .submit(new PodStatusSimulator(server.getClient(), 
intp.getInterpreterNamespace(), intp.getPodName(), intp));
     intp.start("TestUser");
     // then
     assertEquals("Running", intp.getPodPhase());
@@ -458,7 +458,7 @@ public class K8sRemoteInterpreterProcessTest {
         10,
         false,
         true);
-    PodStatusSimulator podStatusSimulator = new 
PodStatusSimulator(server.getClient(), intp.getNamespace(), intp.getPodName(), 
intp);
+    PodStatusSimulator podStatusSimulator = new 
PodStatusSimulator(server.getClient(), intp.getInterpreterNamespace(), 
intp.getPodName(), intp);
     podStatusSimulator.setSecondPhase("Failed");
     podStatusSimulator.setSuccessfulStart(false);
     ExecutorService service = Executors.newFixedThreadPool(1);
@@ -472,7 +472,7 @@ public class K8sRemoteInterpreterProcessTest {
       assertNotNull(e);
       // Check that the Pod is deleted
       assertNull(
-          
server.getClient().pods().inNamespace(intp.getNamespace()).withName(intp.getPodName())
+          
server.getClient().pods().inNamespace(intp.getInterpreterNamespace()).withName(intp.getPodName())
               .get());
     }
   }
@@ -505,7 +505,7 @@ public class K8sRemoteInterpreterProcessTest {
         10,
         false,
         false);
-    PodStatusSimulator podStatusSimulator = new 
PodStatusSimulator(server.getClient(), intp.getNamespace(), intp.getPodName(), 
intp);
+    PodStatusSimulator podStatusSimulator = new 
PodStatusSimulator(server.getClient(), intp.getInterpreterNamespace(), 
intp.getPodName(), intp);
     podStatusSimulator.setFirstPhase("Pending");
     podStatusSimulator.setSecondPhase("Pending");
     podStatusSimulator.setSuccessfulStart(false);
@@ -526,7 +526,7 @@ public class K8sRemoteInterpreterProcessTest {
     // wait for a shutdown
     service.awaitTermination(10, TimeUnit.SECONDS);
     // Check that the Pod is deleted
-    assertNull(server.getClient().pods().inNamespace(intp.getNamespace())
+    
assertNull(server.getClient().pods().inNamespace(intp.getInterpreterNamespace())
         .withName(intp.getPodName()).get());
 
   }

Reply via email to