You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/05/05 15:10:32 UTC
[GitHub] [spark] gaborgsomogyi commented on a change in pull request #28336: [SPARK-31559][YARN] Re-obtain tokens at the startup of AM for yarn cluster mode if principal and keytab are available
gaborgsomogyi commented on a change in pull request #28336:
URL: https://github.com/apache/spark/pull/28336#discussion_r420185561
##########
File path: resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala
##########
@@ -867,6 +868,20 @@ object ApplicationMaster extends Logging {
val originalCreds = UserGroupInformation.getCurrentUser().getCredentials()
SparkHadoopUtil.get.loginUserFromKeytab(principal, sparkConf.get(KEYTAB).orNull)
val newUGI = UserGroupInformation.getCurrentUser()
+
+ if (master.isClusterMode) {
+ // Set the context class loader so that the token manager has access to jars
+ // distributed by the user.
+ Utils.withContextClassLoader(master.userClassLoader) {
+ // Re-obtain delegation tokens, as they might be outdated as of now. Add the fresh
+ // tokens on top of the original user's credentials (overwrite).
+ // This is only needed in cluster mode, because in client mode, AM will soon retrieve
+ // the latest tokens from the driver.
+ val credentialManager = new HadoopDelegationTokenManager(sparkConf, yarnConf, null)
Review comment:
https://github.com/apache/spark/blob/bd264299317bba91f2dc1dc27fd51e6bc0609d66/core/src/main/scala/org/apache/spark/deploy/security/HadoopDelegationTokenManager.scala#L145
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org