You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by pd...@apache.org on 2020/08/10 07:51:24 UTC

[zeppelin] branch master updated: [ZEPPELIN-4988] fix bug when running zeppelin on the machine where k8s is installed

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 e042234  [ZEPPELIN-4988] fix bug when running zeppelin on the machine where k8s is installed
e042234 is described below

commit e042234b9b42b4610922a058de3f0ab8523e2e1b
Author: totorooo <77...@qq.com>
AuthorDate: Fri Aug 7 11:43:04 2020 +0800

    [ZEPPELIN-4988] fix bug when running zeppelin on the machine where k8s is installed
    
    ### What is this PR for?
    solve a issue mentioned in [ZEPPELIN-4988](https://issues.apache.org/jira/browse/ZEPPELIN-4988)
    
    ### What type of PR is it?
    [Bug Fix]
    
    ### What is the Jira issue?
    * [ZEPPELIN-4988](https://issues.apache.org/jira/browse/ZEPPELIN-4988)
    
    ### How should this be tested?
    * covered by the existed unit tests
    * travis-ci: https://travis-ci.org/github/zhoulii/zeppelin/builds/715721363
    * manually test: run zeppelin on a k8s node, the exception in [ZEPPELIN-4988](https://issues.apache.org/jira/browse/ZEPPELIN-4988) does not appear
    
    ### Questions:
    * Does the licenses files need update? **NO**
    * Is there breaking changes for older versions? **NO**
    * Does this needs documentation? **NO**
    
    Author: totorooo <77...@qq.com>
    
    Closes #3874 from zhoulii/run_zeppeplin_on_machine_where_k8s_is_installed and squashes the following commits:
    
    6956fe605 [totorooo] fix bug when running zeppelin on the machine where k8s is installed
---
 .../src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java   | 2 +-
 .../zeppelin/interpreter/launcher/K8sStandardInterpreterLauncher.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
index 112bdbf..3dc65fe 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
@@ -809,7 +809,7 @@ public class ZeppelinConfiguration extends XMLConfiguration {
   public RUN_MODE getRunMode() {
     String mode = getString(ConfVars.ZEPPELIN_RUN_MODE);
     if ("auto".equalsIgnoreCase(mode)) { // auto detect
-      if (new File("/var/run/secrets/kubernetes.io").exists()) {
+      if (new File("/var/run/secrets/kubernetes.io/serviceaccount/namespace").exists()) {
         return RUN_MODE.K8S;
       } else {
         return RUN_MODE.LOCAL;
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 799a91c..bb4b792 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
@@ -63,7 +63,7 @@ public class K8sStandardInterpreterLauncher extends InterpreterLauncher {
    * @return
    */
   boolean isRunningOnKubernetes() {
-    return new File("/var/run/secrets/kubernetes.io").exists();
+    return new File(Config.KUBERNETES_NAMESPACE_PATH).exists();
   }
 
   /**