-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-27702][K8S] Allow using some alternatives for service accounts #24601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Udbhav30 . Could you add a test case this your PR?
|
Gentle ping, @Udbhav30 . |
|
@dongjoon-hyun sorry for the late reply , yes i will check how can i add a test-case for it and update you |
|
Hii @dongjoon-hyun i am unable to simulate this from minikube as there will always be a default service account so i am not sure if i could write any test case for this. if you have any suggestions please let me know. |
|
do we need to document anything here? |
It is already covered as part of tokens and certificate passed by users (eg: kubernetesAuthConfPrefix.OAUTH_TOKEN_CONF_SUFFIX) and also during SPARK-25887 that it can be auto configured in Fabric client using kube-config file. Please let me know if any suggestions thanks. |
|
ok to test |
|
Test build #106550 has finished for PR 24601 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Hii @dongjoon-hyun can you please check if we can merge this. |
|
Sorry for being later, @Udbhav30 . If then, could you describe the test procedure in the
|
Sure! thanks @dongjoon-hyun |
|
What is the status of this PR? Can we merge this? in some multi-tenant k8s cluster, we do not use service account for authenticate. so we should allow using some alternatives for service accounts, such as kubeconfig, oauthToken. |
f1e8207 to
3c9e2d8
Compare
|
Could you take a look at this? @dongjoon-hyun @liyinan926 |
|
Test build #117112 has finished for PR 24601 at commit
|
|
Although we provide some authentication configuration, such as so we need to determine whether KUBERNETES_SERVICE_ACCOUNT_TOKEN_PATH exists. If it does not exist, other configurations are allowed to use, such as |
|
Hi @dongjoon-hyun @liyinan926 can you please review this PR |
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current logic looks like this.
- The difference of this logic is returning
Nonewhen the file doesn't exist. - However,
Noneis not used when the givenoauthTokenFileConfpoints a valid file because it's called asorElse.
val oauthTokenFile = sparkConf.getOption(oauthTokenFileConf)
.map(new File(_))
.orElse(defaultServiceAccountToken)Is the above correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing code already tries to use the given file first. Where did you check the following?
If it does not exist, other configurations are allowed to use, such as spark.kubernetes.authenticate.driver.mounted.oauthTokenFile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing code already tries to use the given file first. Where did you check the following?
If it does not exist, other configurations are allowed to use, such as spark.kubernetes.authenticate.driver.mounted.oauthTokenFile.
Yes but still as we are passing 'KUBERNETES_SERVICE_ACCOUNT_TOKEN_PATH' to create the kubernetesClient , the kubernetes fabric client will use that service account path and will throw error as @wackxu mentioned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Udbhav30 @dongjoon-hyun That is what I means. Let's merge this as soon as possible
|
Retest this please. |
|
Test build #117346 has finished for PR 24601 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
@dongjoon-hyun Could you take a look at this? Thank you. |
|
Can one of the admins verify this patch? |
|
@dongjoon-hyun Hi, Could you take a look at this? This is a bugfix about driver authenticate and we can use other authentication without this. |
|
cc @jiangxb1987 |
|
Kindly ping @dongjoon-hyun @jiangxb1987 @liyinan926 for take a look, thanks. |
|
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
|
I removed |
dongjoon-hyun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, LGTM. Thank you, @Udbhav30 .
Merged to master for Apache Spark 3.1.0.
thanks!! |
What changes were proposed in this pull request?
To allow alternatives to serviceaccounts
Why are the changes needed?
Although we provide some authentication configuration, such as spark.kubernetes.authenticate.driver.mounted.oauthTokenFile, spark.kubernetes.authenticate.driver.mounted.caCertFile, etc.
But there is a bug as we forced the service account so when we use one of them, driver still use the KUBERNETES_SERVICE_ACCOUNT_TOKEN_PATH file, and the error look like bellow:
the KUBERNETES_SERVICE_ACCOUNT_TOKEN_PATH serviceAccount not exists
Does this PR introduce any user-facing change?
Yes user can now use
spark.kubernetes.authenticate.driver.mounted.caCertFileor token file by
spark.kubernetes.authenticate.driver.mounted.oauthTokenFileHow was this patch tested?
Manually passed the certificates using
spark.kubernetes.authenticate.driver.mounted.caCertFileor token file by
spark.kubernetes.authenticate.driver.mounted.oauthTokenFileif there is no default service account available.