This repository was archived by the owner on Jan 9, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/kubernetes Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,14 @@ from the other deployment modes. See the [configuration page](configuration.html
222222 machine's disk.
223223 </td >
224224</tr >
225+ <tr >
226+ <td ><code >spark.kubernetes.submit.oauthToken</code ></td >
227+ <td >(none)</td >
228+ <td >
229+ OAuth token to use when authenticating against the against the Kubernetes API server. Note that unlike the other
230+ authentication options, this should be the exact string value of the token to use for the authentication.
231+ </td >
232+ </tr >
225233<tr >
226234 <td ><code >spark.kubernetes.submit.serviceAccountName</code ></td >
227235 <td ><code >default</code ></td >
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import java.security.SecureRandom
2121import java .util .ServiceLoader
2222import java .util .concurrent .{CountDownLatch , TimeUnit }
2323
24+ import com .google .common .base .Charsets
2425import com .google .common .io .Files
2526import com .google .common .util .concurrent .SettableFuture
2627import io .fabric8 .kubernetes .api .model ._
@@ -131,6 +132,11 @@ private[spark] class Client(
131132 sparkConf.get(KUBERNETES_CLIENT_CERT_FILE ).foreach {
132133 f => k8ConfBuilder = k8ConfBuilder.withClientCertFile(f)
133134 }
135+ sparkConf.get(KUBERNETES_OAUTH_TOKEN ).foreach { token =>
136+ k8ConfBuilder = k8ConfBuilder.withOauthToken(token)
137+ // Remove the oauth token from Spark conf so that its doesn't appear in the Spark UI.
138+ sparkConf.set(KUBERNETES_OAUTH_TOKEN , " <present_but_redacted>" )
139+ }
134140
135141 val k8ClientConfig = k8ConfBuilder.build
136142 Utils .tryWithResource(new DefaultKubernetesClient (k8ClientConfig)) { kubernetesClient =>
Original file line number Diff line number Diff line change @@ -83,6 +83,18 @@ package object config {
8383 .stringConf
8484 .createOptional
8585
86+ private [spark] val KUBERNETES_OAUTH_TOKEN =
87+ ConfigBuilder (" spark.kubernetes.submit.oauthToken" )
88+ .doc("""
89+ | OAuth token to use when authenticating against the
90+ | against the Kubernetes API server. Note that unlike
91+ | the other authentication options, this should be the
92+ | exact string value of the token to use for the
93+ | authentication.
94+ """ .stripMargin)
95+ .stringConf
96+ .createOptional
97+
8698 private [spark] val KUBERNETES_SERVICE_ACCOUNT_NAME =
8799 ConfigBuilder (" spark.kubernetes.submit.serviceAccountName" )
88100 .doc("""
You can’t perform that action at this time.
0 commit comments