LucaCanali commented on a change in pull request #23525: [SPARK-26595][core]
Allow credential renewal based on kerberos ticket cache.
URL: https://github.com/apache/spark/pull/23525#discussion_r247840564
##########
File path:
core/src/main/scala/org/apache/spark/deploy/security/HadoopDelegationTokenManager.scala
##########
@@ -236,11 +257,19 @@ private[spark] class HadoopDelegationTokenManager(
}
private def doLogin(): UserGroupInformation = {
- logInfo(s"Attempting to login to KDC using principal: $principal")
- require(new File(keytab).isFile(), s"Cannot find keytab at $keytab.")
- val ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI(principal,
keytab)
- logInfo("Successfully logged into KDC.")
- ugi
+ if (principal != null) {
+ logInfo(s"Attempting to login to KDC using principal: $principal")
+ require(new File(keytab).isFile(), s"Cannot find keytab at $keytab.")
+ val ugi =
UserGroupInformation.loginUserFromKeytabAndReturnUGI(principal, keytab)
+ logInfo("Successfully logged into KDC.")
+ ugi
+ } else {
+ logInfo(s"Attempting to load user's ticket cache.")
+ val ccache = sparkConf.getenv("KRB5CCNAME")
+ val user = Option(sparkConf.getenv("KRB5PRINCIPAL")).getOrElse(
Review comment:
Would it make sense to check also the value of spark.yarn.principal is
provided by the user?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]