Skip to content

Commit 4d65bfc

Browse files
author
ArtRand
committed
addressed comments
1 parent bcdb3ce commit 4d65bfc

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

docs/running-on-mesos.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ To get started, follow the steps below to install Mesos and deploy Spark jobs vi
3333
# Installing Mesos
3434

3535
Spark {{site.SPARK_VERSION}} is designed for use with Mesos {{site.MESOS_VERSION}} or newer and does not
36-
require any special patches of Mesos.
36+
require any special patches of Mesos. File and environment-based secrets support requires Mesos 1.3.0 or
37+
newer.
3738

3839
If you already have a Mesos cluster running, you can skip this Mesos installation step.
3940

@@ -426,7 +427,8 @@ See the [configuration page](configuration.html) for information on Spark config
426427
<td><code>spark.mesos.secret</code></td>
427428
<td>(none)</td>
428429
<td>
429-
Set the secret with which Spark framework will use to authenticate with Mesos.
430+
Set the secret with which Spark framework will use to authenticate with Mesos. Used, for example, when
431+
authenticating with the registry.
430432
</td>
431433
</tr>
432434
<tr>
@@ -482,7 +484,7 @@ See the [configuration page](configuration.html) for information on Spark config
482484
<td><code>spark.mesos.driver.secret.envkey</code></td>
483485
<td><code>(none)</code></td>
484486
<td>
485-
A comma-seperated list that, if set, the contents of the secret referenced
487+
A comma-separated list that, if set, the contents of the secret referenced
486488
by spark.mesos.driver.secret.name or spark.mesos.driver.value will be
487489
written to the provided environment variable in the driver's process.
488490
</td>
@@ -491,7 +493,7 @@ See the [configuration page](configuration.html) for information on Spark config
491493
<td><code>spark.mesos.driver.secret.filename</code></td>
492494
<td><code>(none)</code></td>
493495
<td>
494-
A comma-seperated list that, if set, the contents of the secret referenced by
496+
A comma-separated list that, if set, the contents of the secret referenced by
495497
spark.mesos.driver.secret.name or spark.mesos.driver.secret.value will be
496498
written to the provided file. Relative paths are relative to the container's work
497499
directory. Absolute paths must already exist. Consult the Mesos Secret
@@ -502,15 +504,15 @@ See the [configuration page](configuration.html) for information on Spark config
502504
<td><code>spark.mesos.driver.secret.name</code></td>
503505
<td><code>(none)</code></td>
504506
<td>
505-
A comma-seperated list of secret references. Consult the Mesos Secret
507+
A comma-separated list of secret references. Consult the Mesos Secret
506508
protobuf for more information.
507509
</td>
508510
</tr>
509511
<tr>
510512
<td><code>spark.mesos.driver.secret.value</code></td>
511513
<td><code>(none)</code></td>
512514
<td>
513-
A comma-seperated list of secret values. Consult the Mesos Secret
515+
A comma-separated list of secret values. Consult the Mesos Secret
514516
protobuf for more information.
515517
</td>
516518
</tr>

docs/security.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ For long-running apps like Spark Streaming apps to be able to write to HDFS, it
7373
### Standalone mode
7474
The user needs to provide key-stores and configuration options for master and workers. They have to be set by attaching appropriate Java system properties in `SPARK_MASTER_OPTS` and in `SPARK_WORKER_OPTS` environment variables, or just in `SPARK_DAEMON_JAVA_OPTS`. In this mode, the user may allow the executors to use the SSL settings inherited from the worker which spawned that executor. It can be accomplished by setting `spark.ssl.useNodeLocalConf` to `true`. If that parameter is set, the settings provided by user on the client side, are not used by the executors.
7575

76+
### Mesos mode
77+
Mesos 1.3.0 and newer supports `Secrets` primitives as both file-based and environment based secrets. Spark allows the specification of file-based and environment variable based secrets with the `spark.mesos.driver.secret.filename` and `spark.mesos.driver.secret.envkey`, respectively. Depending on the secret store backend secrets can be passed by reference or by value with the `spark.mesos.driver.secret.name` and `spark.mesos.driver.secret.value` configuration properties, respectively. Reference type secrets are served by the secret store and referred to by name, for example `/mysecret`. Value type secrets are passed on the command line and translated into their appropriate files or environment variables.
78+
7679
### Preparing the key-stores
7780
Key-stores can be generated by `keytool` program. The reference documentation for this tool is
7881
[here](https://docs.oracle.com/javase/7/docs/technotes/tools/solaris/keytool.html). The most basic

resource-managers/mesos/src/main/scala/org/apache/spark/deploy/mesos/config.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,28 @@ package object config {
5858

5959
private [spark] val DRIVER_LABELS =
6060
ConfigBuilder("spark.mesos.driver.labels")
61-
.doc("Mesos labels to add to the driver. Labels are free-form key-value pairs. Key-value" +
61+
.doc("Mesos labels to add to the driver. Labels are free-form key-value pairs. Key-value " +
6262
"pairs should be separated by a colon, and commas used to list more than one." +
6363
"Ex. key:value,key2:value2")
6464
.stringConf
6565
.createOptional
6666

6767
private[spark] val SECRET_NAME =
6868
ConfigBuilder("spark.mesos.driver.secret.name")
69-
.doc("A comma-seperated list of secret references. Consult the Mesos Secret protobuf for " +
69+
.doc("A comma-separated list of secret references. Consult the Mesos Secret protobuf for " +
7070
"more information.")
7171
.stringConf
7272
.createOptional
7373

7474
private[spark] val SECRET_VALUE =
7575
ConfigBuilder("spark.mesos.driver.secret.value")
76-
.doc("A comma-seperated list of secret values.")
76+
.doc("A comma-separated list of secret values.")
7777
.stringConf
7878
.createOptional
7979

8080
private[spark] val SECRET_ENVKEY =
8181
ConfigBuilder("spark.mesos.driver.secret.envkey")
82-
.doc("A comma-seperated list of the environment variables to contain the secrets." +
82+
.doc("A comma-separated list of the environment variables to contain the secrets." +
8383
"The environment variable will be set on the driver.")
8484
.stringConf
8585
.createOptional

resource-managers/mesos/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosClusterScheduler.scala

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,12 @@ private[spark] class MesosClusterScheduler(
397397

398398
// add secret environment variables
399399
getSecretEnvVar(desc).foreach { variable =>
400-
logInfo(s"Setting secret name=${variable.getSecret.getReference.getName} " +
401-
s"on environment variable name=${variable.getName}")
402-
400+
if (variable.getSecret.getReference.isInitialized) {
401+
logInfo(s"Setting reference secret ${variable.getSecret.getReference.getName}" +
402+
s"on file ${variable.getName}")
403+
} else {
404+
logInfo(s"Setting secret on environment variable name=${variable.getName}")
405+
}
403406
envBuilder.addVariables(variable)
404407
}
405408

@@ -589,9 +592,12 @@ private[spark] class MesosClusterScheduler(
589592
val containerInfo = MesosSchedulerBackendUtil.containerInfo(desc.conf)
590593

591594
getSecretVolume(desc).foreach { volume =>
592-
logInfo(s"Setting secret name=${volume.getSource.getSecret.getReference.getName} " +
593-
s"on file name=${volume.getContainerPath}")
594-
595+
if (volume.getSource.getSecret.getReference.isInitialized) {
596+
logInfo(s"Setting reference secret ${volume.getSource.getSecret.getReference.getName}" +
597+
s"on file ${volume.getContainerPath}")
598+
} else {
599+
logInfo(s"Setting secret on file name=${volume.getContainerPath}")
600+
}
595601
containerInfo.addVolumes(volume)
596602
}
597603

@@ -639,8 +645,6 @@ private[spark] class MesosClusterScheduler(
639645
if (referenceSecrets.nonEmpty) referenceSecrets else valueSecrets
640646
}
641647

642-
643-
644648
private def illegalSecretInput(dest: Seq[String], s: Seq[Secret]): Boolean = {
645649
if (dest.isEmpty) { // no destination set (ie not using secrets of this type
646650
return false

0 commit comments

Comments
 (0)