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

    https://github.com/apache/spark/pull/18837#discussion_r135640958
  
    --- Diff: 
resource-managers/mesos/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosClusterScheduler.scala
 ---
    @@ -383,15 +385,57 @@ private[spark] class MesosClusterScheduler(
           v => s"$v 
-Dspark.mesos.driver.frameworkId=${getDriverFrameworkID(desc)}"
         )
     
    -    val env = desc.conf.getAllWithPrefix("spark.mesos.driverEnv.") ++ 
commandEnv
    +    val driverEnv = desc.conf.getAllWithPrefix("spark.mesos.driverEnv.")
    +    val env = driverEnv ++ commandEnv
     
         val envBuilder = Environment.newBuilder()
    +
    +    // add normal environment variables
         env.foreach { case (k, v) =>
           envBuilder.addVariables(Variable.newBuilder().setName(k).setValue(v))
         }
    +
    +    // add secret environment variables
    +    getSecretEnvVar(desc).foreach { variable =>
    +      if (variable.getSecret.getReference.isInitialized) {
    +        logInfo(s"Setting reference secret 
${variable.getSecret.getReference.getName}" +
    +          s"on file ${variable.getName}")
    +      } else {
    +        logInfo(s"Setting secret on environment variable 
name=${variable.getName}")
    +      }
    +      envBuilder.addVariables(variable)
    +    }
    +
         envBuilder.build()
       }
     
    +  private def getSecretEnvVar(desc: MesosDriverDescription): 
List[Variable] = {
    +    val secrets = getSecrets(desc)
    +    val secretEnvKeys = {
    +      if (desc.conf.get(config.SECRET_ENVKEY).isDefined) {
    --- End diff --
    
    This kind of pattern is not really necessary.
    
    You can either use `conf.get(BLAH).getOrElse(Nil)`, or declare `Nil` as the 
default when creating the config constant.


---
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