You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2023/03/30 18:43:37 UTC

[kyuubi] branch branch-1.7 updated: [KYUUBI #3872][BATCH] Skip setting proxy user when keytab is provided

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

chengpan pushed a commit to branch branch-1.7
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.7 by this push:
     new d885f1943 [KYUUBI #3872][BATCH]  Skip setting proxy user when keytab is provided
d885f1943 is described below

commit d885f194318b6784634116bebbd24ba0f105a7d1
Author: wangyepeng2 <ye...@convertlab.com>
AuthorDate: Fri Mar 31 02:42:56 2023 +0800

    [KYUUBI #3872][BATCH]  Skip setting proxy user when keytab is provided
    
    ### _Why are the changes needed?_
    
    Fix #3872
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [X] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #4640 from wangyepeng2/proxy_user_fix.
    
    Closes #3872
    
    c7228b916 [Cheng Pan] Update kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala
    b6f41d1b5 [Cheng Pan] Update kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkBatchProcessBuilder.scala
    ecf3b3b18 [wangyepeng2] change function name to setupKerberos
    63fc5deef [wangyepeng2] fix:spark batch submit should not set proxy user when keytab is used
    
    Lead-authored-by: wangyepeng2 <ye...@convertlab.com>
    Co-authored-by: Cheng Pan <pa...@gmail.com>
    Co-authored-by: wangyepeng2 <44...@users.noreply.github.com>
    Signed-off-by: Cheng Pan <ch...@apache.org>
    (cherry picked from commit 4c2f1e6abe0c6aaebb5e79e6bd164bf8a0733d5f)
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../kyuubi/engine/spark/SparkBatchProcessBuilder.scala   |  4 +---
 .../apache/kyuubi/engine/spark/SparkProcessBuilder.scala | 16 ++++++++++------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkBatchProcessBuilder.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkBatchProcessBuilder.scala
index 4c0365841..4a613278d 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkBatchProcessBuilder.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkBatchProcessBuilder.scala
@@ -56,9 +56,7 @@ class SparkBatchProcessBuilder(
       buffer += s"${convertConfigKey(k)}=$v"
     }
 
-    setSparkUserName(proxyUser, buffer)
-    buffer += PROXY_USER
-    buffer += proxyUser
+    setupKerberos(buffer)
 
     assert(mainResource.isDefined)
     buffer += mainResource.get
diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala
index 874a36c00..b74eab77d 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala
@@ -121,6 +121,16 @@ class SparkProcessBuilder(
       buffer += s"${convertConfigKey(k)}=$v"
     }
 
+    setupKerberos(buffer)
+
+    mainResource.foreach { r => buffer += r }
+
+    buffer.toArray
+  }
+
+  override protected def module: String = "kyuubi-spark-sql-engine"
+
+  protected def setupKerberos(buffer: ArrayBuffer[String]): Unit = {
     // if the keytab is specified, PROXY_USER is not supported
     tryKeytab() match {
       case None =>
@@ -130,14 +140,8 @@ class SparkProcessBuilder(
       case Some(name) =>
         setSparkUserName(name, buffer)
     }
-
-    mainResource.foreach { r => buffer += r }
-
-    buffer.toArray
   }
 
-  override protected def module: String = "kyuubi-spark-sql-engine"
-
   private def tryKeytab(): Option[String] = {
     val principal = conf.getOption(PRINCIPAL)
     val keytab = conf.getOption(KEYTAB)