You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2019/09/24 16:59:56 UTC

[zeppelin] branch master updated: [ZEPPELIN-4337] Make Zeppelin runs on kubernetes with different domain suffix

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

moon 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 97dfb3e  [ZEPPELIN-4337] Make Zeppelin runs on kubernetes with different domain suffix
97dfb3e is described below

commit 97dfb3e6c0e267a4597336fc70a3908f2186da3e
Author: Lee moon soo <mo...@apache.org>
AuthorDate: Thu Sep 19 12:06:17 2019 -0700

    [ZEPPELIN-4337] Make Zeppelin runs on kubernetes with different domain suffix
    
    ### What is this PR for?
    
    A couple of hardcoded dns suffix in the source code (cluster.local). Remove them so Zeppelin have better compatibility with Kubernetes cluster with dns name.
    
    ### What type of PR is it?
    Improvement
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/ZEPPELIN-4337
    
    ### How should this be tested?
    Should work on Kubernetes cluster with different cluster dns name than 'cluster.local'
    
    ### Questions:
    * Does the licenses files need update? no
    * Is there breaking changes for older versions? no
    * Does this needs documentation? no
    
    Author: Lee moon soo <mo...@apache.org>
    
    Closes #3454 from Leemoonsoo/ZEPPELIN-4337 and squashes the following commits:
    
    ae736b1c3 [Lee moon soo] remove cluster.local suffix
---
 k8s/zeppelin-server.yaml                                              | 2 +-
 .../zeppelin/interpreter/launcher/K8sRemoteInterpreterProcess.java    | 2 +-
 .../zeppelin/interpreter/launcher/K8sStandardInterpreterLauncher.java | 4 ++--
 .../interpreter/launcher/K8sRemoteInterpreterProcessTest.java         | 2 +-
 .../interpreter/launcher/K8sStandardInterpreterLauncherTest.java      | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/k8s/zeppelin-server.yaml b/k8s/zeppelin-server.yaml
index dbee39c..ecb7606 100644
--- a/k8s/zeppelin-server.yaml
+++ b/k8s/zeppelin-server.yaml
@@ -61,7 +61,7 @@ data:
         server_name "~(?<svc_port>[0-9]+)-(?<svc_name>[^.]*)\.(.*)";
         location / {
           resolver 127.0.0.1:53 ipv6=off;
-          proxy_pass http://$svc_name.NAMESPACE.svc.cluster.local:$svc_port;
+          proxy_pass http://$svc_name.NAMESPACE.svc:$svc_port;
           proxy_set_header Host $host;
           proxy_http_version 1.1;
           proxy_set_header Upgrade $http_upgrade;
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 afa8541..63b5a3e 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
@@ -321,7 +321,7 @@ public class K8sRemoteInterpreterProcess extends RemoteInterpreterProcess {
   }
 
   private String getInterpreterPodDnsName() {
-    return String.format("%s.%s.svc.cluster.local",
+    return String.format("%s.%s.svc",
         getPodName(), // service name and pod name is the same
         kubectl.getNamespace());
   }
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 4f2ed91..3f2e39d 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
@@ -103,12 +103,12 @@ public class K8sStandardInterpreterLauncher extends InterpreterLauncher {
 
   /**
    * get Zeppelin server host dns.
-   * return <hostname>.<namespace>.svc.cluster.local
+   * return <hostname>.<namespace>.svc
    * @throws IOException
    */
   private String getZeppelinServiceHost() throws IOException {
     if (isRunningOnKubernetes()) {
-      return String.format("%s.%s.svc.cluster.local",
+      return String.format("%s.%s.svc",
               getHostname(), // service name and pod name should be the same
               getNamespace());
     } else {
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 ce2a2cb..d08e73a 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
@@ -60,7 +60,7 @@ public class K8sRemoteInterpreterProcessTest {
     int port = intp.getPort();
 
     // then
-    assertEquals(String.format("%s.%s.svc.cluster.local", intp.getPodName(), kubectl.getNamespace()), intp.getHost());
+    assertEquals(String.format("%s.%s.svc", intp.getPodName(), kubectl.getNamespace()), intp.getHost());
     assertEquals(12321, intp.getPort());
   }
 
diff --git a/zeppelin-plugins/launcher/k8s-standard/src/test/java/org/apache/zeppelin/interpreter/launcher/K8sStandardInterpreterLauncherTest.java b/zeppelin-plugins/launcher/k8s-standard/src/test/java/org/apache/zeppelin/interpreter/launcher/K8sStandardInterpreterLauncherTest.java
index 74805cd..4cd035a 100644
--- a/zeppelin-plugins/launcher/k8s-standard/src/test/java/org/apache/zeppelin/interpreter/launcher/K8sStandardInterpreterLauncherTest.java
+++ b/zeppelin-plugins/launcher/k8s-standard/src/test/java/org/apache/zeppelin/interpreter/launcher/K8sStandardInterpreterLauncherTest.java
@@ -53,7 +53,7 @@ public class K8sStandardInterpreterLauncherTest {
     Properties properties = new Properties();
     properties.setProperty("ENV_1", "VALUE_1");
     properties.setProperty("property_1", "value_1");
-    properties.setProperty("CALLBACK_HOST", "zeppelin-server.default.svc.cluster.local");
+    properties.setProperty("CALLBACK_HOST", "zeppelin-server.default.svc");
     properties.setProperty("CALLBACK_PORT", "12320");
     InterpreterOption option = new InterpreterOption();
     option.setUserImpersonate(true);