Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18978#discussion_r134021622
  
    --- Diff: 
resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala 
---
    @@ -1149,6 +1156,43 @@ private[spark] class Client(
         }
       }
     
    +  private def setupAMConnection(
    +      appId: ApplicationId,
    +      securityManager: SecurityManager): RpcEndpointRef = {
    +    val report = getApplicationReport(appId)
    +    val state = report.getYarnApplicationState
    +    if (report.getHost() == null || "".equals(report.getHost())) {
    +      throw new SparkException(s"AM for $appId not assigned or dont have 
view ACL for it")
    +    }
    +    if ( state != YarnApplicationState.RUNNING) {
    +      throw new SparkException(s"Application $appId needs to be in 
RUNNING")
    +    }
    +
    +    if (UserGroupInformation.isSecurityEnabled()) {
    +      val serviceAddr = new InetSocketAddress(report.getHost(), 
report.getRpcPort())
    +
    +      val clientToAMToken = report.getClientToAMToken
    +      val token = ConverterUtils.convertFromYarn(clientToAMToken, 
serviceAddr)
    +
    +      // Fetch Identifier, secretkey from the report, encode it  and Set 
it in the Security Manager
    --- End diff --
    
    I would change this comment to just say why we encode it here..  encode the 
token identifier and secret because they can contain binary data. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to