Skip to content

Commit

Permalink
[SPARK-19995][YARN] Register tokens to current UGI to avoid re-issuin…
Browse files Browse the repository at this point in the history
…g of tokens in yarn client mode

## What changes were proposed in this pull request?

In the current Spark on YARN code, we will obtain tokens from provided services, but we're not going to add these tokens to the current user's credentials. This will make all the following operations to these services still require TGT rather than delegation tokens. This is unnecessary since we already got the tokens, also this will lead to failure in user impersonation scenario, because the TGT is granted by real user, not proxy user.

So here changing to put all the tokens to the current UGI, so that following operations to these services will honor tokens rather than TGT, and this will further handle the proxy user issue mentioned above.

## How was this patch tested?

Local verified in secure cluster.

vanzin tgravescs mridulm  dongjoon-hyun please help to review, thanks a lot.

Author: jerryshao <[email protected]>

Closes #17335 from jerryshao/SPARK-19995.
  • Loading branch information
jerryshao authored and Marcelo Vanzin committed Mar 28, 2017
1 parent f82461f commit 17eddb3
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,9 @@ private[spark] class Client(
val nearestTimeOfNextRenewal = credentialManager.obtainCredentials(hadoopConf, credentials)

if (credentials != null) {
// Add credentials to current user's UGI, so that following operations don't need to use the
// Kerberos tgt to get delegations again in the client side.
UserGroupInformation.getCurrentUser.addCredentials(credentials)
logDebug(YarnSparkHadoopUtil.get.dumpTokens(credentials).mkString("\n"))
}

Expand Down

0 comments on commit 17eddb3

Please sign in to comment.