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

    https://github.com/apache/spark/pull/18837#discussion_r135852456
  
    --- Diff: 
resource-managers/mesos/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosClusterScheduler.scala
 ---
    @@ -529,18 +566,113 @@ private[spark] class MesosClusterScheduler(
     
         val appName = desc.conf.get("spark.app.name")
     
    +    val driverLabels = 
MesosProtoUtils.mesosLabels(desc.conf.get(config.DRIVER_LABELS)
    +      .getOrElse(""))
    +
         TaskInfo.newBuilder()
           .setTaskId(taskId)
           .setName(s"Driver for ${appName}")
           .setSlaveId(offer.offer.getSlaveId)
           .setCommand(buildDriverCommand(desc))
    +      .setContainer(getContainerInfo(desc))
           .addAllResources(cpuResourcesToUse.asJava)
           .addAllResources(memResourcesToUse.asJava)
    -      
.setLabels(MesosProtoUtils.mesosLabels(desc.conf.get(config.DRIVER_LABELS).getOrElse("")))
    -      .setContainer(MesosSchedulerBackendUtil.containerInfo(desc.conf))
    +      .setLabels(driverLabels)
           .build
       }
     
    +  private def getContainerInfo(desc: MesosDriverDescription): 
ContainerInfo.Builder = {
    +    val containerInfo = MesosSchedulerBackendUtil.containerInfo(desc.conf)
    +
    +    getSecretVolume(desc).foreach { volume =>
    +      if (volume.getSource.getSecret.getReference.isInitialized) {
    +        logInfo(s"Setting reference secret 
${volume.getSource.getSecret.getReference.getName}" +
    +          s"on file ${volume.getContainerPath}")
    +      } else {
    +        logInfo(s"Setting secret on file name=${volume.getContainerPath}")
    +      }
    +      containerInfo.addVolumes(volume)
    +    }
    +
    +    containerInfo
    +  }
    +
    +
    +  private def getSecrets(desc: MesosDriverDescription): Seq[Secret] = {
    +    def createValueSecret(data: String): Secret = {
    +      Secret.newBuilder()
    +        .setType(Secret.Type.VALUE)
    +        
.setValue(Secret.Value.newBuilder().setData(ByteString.copyFrom(data.getBytes)))
    +        .build()
    +    }
    +
    +    def createReferenceSecret(name: String): Secret = {
    +      Secret.newBuilder()
    +        .setReference(Secret.Reference.newBuilder().setName(name))
    +        .setType(Secret.Type.REFERENCE)
    +        .build()
    +    }
    +
    +    val referenceSecrets: Seq[Secret] = {
    +      if (desc.conf.get(config.SECRET_NAME).isDefined) {
    --- End diff --
    
    Are you going to fix this kind of code according to my previous suggestion?
    
    ```
    desc.conf.get(config.SECRET_NAME).getOrElse(Nil).map(...)
    ```



---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to