dongjoon-hyun commented on a change in pull request #24601: [SPARK-27702][K8S]
Allow using some alternatives for service accounts
URL: https://github.com/apache/spark/pull/24601#discussion_r370503859
##########
File path:
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/KubernetesClusterManager.scala
##########
@@ -50,10 +50,14 @@ private[spark] class KubernetesClusterManager extends
ExternalClusterManager wit
require(sc.conf.get(KUBERNETES_DRIVER_POD_NAME).isDefined,
"If the application is deployed using spark-submit in cluster mode,
the driver pod name " +
"must be provided.")
+ val serviceAccountToken =
+ Some(new
File(Config.KUBERNETES_SERVICE_ACCOUNT_TOKEN_PATH)).filter(_.exists)
+ val serviceAccountCaCrt =
+ Some(new
File(Config.KUBERNETES_SERVICE_ACCOUNT_CA_CRT_PATH)).filter(_.exists)
Review comment:
The current logic looks like this.
1. The difference of this logic is returning `None` when the file doesn't
exist.
2. However, `None` is not used when the given `oauthTokenFileConf` points a
valid file because it's called as `orElse`.
```scala
val oauthTokenFile = sparkConf.getOption(oauthTokenFileConf)
.map(new File(_))
.orElse(defaultServiceAccountToken)
```
Is the above correct?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]