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
222
222
machine's disk.
223
223
</td >
224
224
</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 >
225
233
<tr >
226
234
<td ><code >spark.kubernetes.submit.serviceAccountName</code ></td >
227
235
<td ><code >default</code ></td >
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import java.security.SecureRandom
21
21
import java .util .ServiceLoader
22
22
import java .util .concurrent .{CountDownLatch , TimeUnit }
23
23
24
+ import com .google .common .base .Charsets
24
25
import com .google .common .io .Files
25
26
import com .google .common .util .concurrent .SettableFuture
26
27
import io .fabric8 .kubernetes .api .model ._
@@ -131,6 +132,11 @@ private[spark] class Client(
131
132
sparkConf.get(KUBERNETES_CLIENT_CERT_FILE ).foreach {
132
133
f => k8ConfBuilder = k8ConfBuilder.withClientCertFile(f)
133
134
}
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
+ }
134
140
135
141
val k8ClientConfig = k8ConfBuilder.build
136
142
Utils .tryWithResource(new DefaultKubernetesClient (k8ClientConfig)) { kubernetesClient =>
Original file line number Diff line number Diff line change @@ -83,6 +83,18 @@ package object config {
83
83
.stringConf
84
84
.createOptional
85
85
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
+
86
98
private [spark] val KUBERNETES_SERVICE_ACCOUNT_NAME =
87
99
ConfigBuilder (" spark.kubernetes.submit.serviceAccountName" )
88
100
.doc("""
You can’t perform that action at this time.
0 commit comments