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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9d8476a  [KYUUBI #1471] Improve log if user specify the spark 
principal and keytab but not same with proxy user
9d8476a is described below

commit 9d8476a3f292b1b40dfe8da21664e0f55eec4929
Author: ulysses-you <[email protected]>
AuthorDate: Tue Nov 30 18:13:47 2021 +0800

    [KYUUBI #1471] Improve log if user specify the spark principal and keytab 
but not same with proxy user
    
    <!--
    Thanks for sending a pull request!
    
    Here are some tips for you:
      1. If this is your first time, please read our contributor guidelines: 
https://kyuubi.readthedocs.io/en/latest/community/contributions.html
      2. If the PR is related to an issue in 
https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your 
PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
      3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., 
'[WIP][KYUUBI #XXXX] Your PR title ...'.
    -->
    
    ### _Why are the changes needed?_
    <!--
    Please clarify why the changes are needed. For instance,
      1. If you add a feature, you can talk about the use case of it.
      2. If you fix a bug, you can clarify why it is a bug.
    -->
    Add the warning log instead of hiding the behavior implicitly.
    
    ### _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
    
    - [ ] [Run 
test](https://kyuubi.readthedocs.io/en/latest/develop_tools/testing.html#running-tests)
 locally before make a pull request
    
    Closes #1471 from ulysses-you/log.
    
    Closes #1471
    
    3c9ae370 [ulysses-you] improve log
    
    Authored-by: ulysses-you <[email protected]>
    Signed-off-by: ulysses-you <[email protected]>
---
 .../org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala      | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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 9fd5812..b78a5ad 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
@@ -184,7 +184,13 @@ class SparkProcessBuilder(
       try {
         val ugi = UserGroupInformation
           .loginUserFromKeytabAndReturnUGI(principal.get, keytab.get)
-        ugi.getShortUserName == proxyUser
+        val keytabEnabled = ugi.getShortUserName == proxyUser
+        if (!keytabEnabled) {
+          warn(s"The session proxy user: $proxyUser is not same with " +
+            s"spark principal: ${ugi.getShortUserName}, so we can't support 
use keytab. " +
+            s"Fallback to use proxy user.")
+        }
+        keytabEnabled
       } catch {
         case e: IOException =>
           error(s"Failed to login for ${principal.get}", e)

Reply via email to