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

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


The following commit(s) were added to refs/heads/master by this push:
     new a8da410  [SPARK-25689][CORE] Follow up: don't get delegation tokens 
when kerberos not available.
a8da410 is described below

commit a8da41061fb38529e90c41571b38294ab5ddc441
Author: Marcelo Vanzin <van...@cloudera.com>
AuthorDate: Wed Jan 30 09:52:50 2019 -0800

    [SPARK-25689][CORE] Follow up: don't get delegation tokens when kerberos 
not available.
    
    This avoids trying to get delegation tokens when a TGT is not available, 
e.g.
    when running in yarn-cluster mode without a keytab. That would result in an
    error since that is not allowed.
    
    Tested with some (internal) integration tests that started failing with the
    patch for SPARK-25689.
    
    Closes #23689 from vanzin/SPARK-25689.followup.
    
    Authored-by: Marcelo Vanzin <van...@cloudera.com>
    Signed-off-by: Marcelo Vanzin <van...@cloudera.com>
---
 .../spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
 
b/core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
index 6bc0bdd..0111b83 100644
--- 
a/core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
+++ 
b/core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
@@ -401,12 +401,15 @@ class CoarseGrainedSchedulerBackend(scheduler: 
TaskSchedulerImpl, val rpcEnv: Rp
     if (UserGroupInformation.isSecurityEnabled()) {
       delegationTokenManager = createTokenManager()
       delegationTokenManager.foreach { dtm =>
+        val ugi = UserGroupInformation.getCurrentUser()
         val tokens = if (dtm.renewalEnabled) {
           dtm.start()
-        } else {
-          val creds = UserGroupInformation.getCurrentUser().getCredentials()
+        } else if (ugi.hasKerberosCredentials()) {
+          val creds = ugi.getCredentials()
           dtm.obtainDelegationTokens(creds)
           SparkHadoopUtil.get.serialize(creds)
+        } else {
+          null
         }
         if (tokens != null) {
           updateDelegationTokens(tokens)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to