Skip to content

[SPARK] Kyuubi should set env SPARK_USER_NAME for K8s deployment - #3527

Closed
zwangsheng wants to merge 3 commits into
apache:masterfrom
zwangsheng:feature/add_spark_user_name
Closed

[SPARK] Kyuubi should set env SPARK_USER_NAME for K8s deployment#3527
zwangsheng wants to merge 3 commits into
apache:masterfrom
zwangsheng:feature/add_spark_user_name

Conversation

@zwangsheng

@zwangshengzwangsheng commented Sep 20, 2022

Copy link
Copy Markdown
Contributor

Why are the changes needed?

On case spark on kubernetes, spark using env SPARK_USER_NAME as user name.
So kyuubi should build spark engine with this env when proxy user or using keytab.
This conf only affect on kubernetes case.

Ref: apache/spark#23017

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before make a pull request

@zwangsheng

zwangsheng commented Sep 20, 2022

Copy link
Copy Markdown
ContributorAuthor

plz help check @pan3793@turboFei@wForget

@pan3793pan3793 changed the title [FEATURE][SPARK] Build Spark engine with env SPARK_USER_NAME using proxyName or keytab shortUserName[FEATURE][SPARK] Kyuubi should set env SPARK_USER_NAME for K8s deploymentSep 20, 2022
@pan3793pan3793 changed the title [FEATURE][SPARK] Kyuubi should set env SPARK_USER_NAME for K8s deployment[SPARK] Build Spark engine with env SPARK_USER_NAME using proxyName or keytab shortUserNameSep 20, 2022
@pan3793pan3793 changed the title [SPARK] Build Spark engine with env SPARK_USER_NAME using proxyName or keytab shortUserName[SPARK] Kyuubi should set env SPARK_USER_NAME for K8s deploymentSep 20, 2022
@pan3793pan3793 added this to the v1.6.1 milestone Sep 20, 2022
@codecov-commenter

codecov-commenter commented Sep 21, 2022

Copy link
Copy Markdown

Codecov Report

Merging #3527 (9596372) into master (73612b7) will increase coverage by 0.00%.
The diff coverage is 88.88%.

@@ Coverage Diff @@## master #3527 +/- ##
=========================================
Coverage 51.67% 51.67% Complexity 13 13 =========================================
Files 482 482 Lines 26933 26943 +10 Branches 3760 3760 =========================================
+ Hits 13917 13923 +6 - Misses 11661 11664 +3 - Partials 1355 1356 +1 
Impacted FilesCoverage Δ
...ache/kyuubi/engine/spark/SparkProcessBuilder.scala86.66% <88.88%> (+0.41%)⬆️
...ache/kyuubi/operation/KyuubiOperationManager.scala79.45% <0.00%> (-2.74%)⬇️
...che/kyuubi/server/KyuubiTHttpFrontendService.scala64.23% <0.00%> (-0.73%)⬇️
...n/scala/org/apache/kyuubi/engine/ProcBuilder.scala80.74% <0.00%> (-0.63%)⬇️
...g/apache/kyuubi/operation/BatchJobSubmission.scala74.64% <0.00%> (ø)
...a/org/apache/kyuubi/service/TFrontendService.scala91.47% <0.00%> (+0.29%)⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

// For spark on kubernetes, spark pod using env SPARK_USER_NAME as current user
def setSparkUserName(userName: String): Unit = {
clusterManager().foreach(cm => {
if (cm.startsWith("k8s://")) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no harm to set for all cluster managers?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spark.kubernetes.driverEnv. only affect on kubernetes case. We are only setting up this On Kubernetes for now.
As for SPARK_USER_NAME this env, it's affect in spark/kubernetes/entrypoint.sh

@pan3793

Copy link
Copy Markdown
Member

Thanks, merging to master/1.6

pan3793 pushed a commit that referenced this pull request Sep 23, 2022
…deployment
### _Why are the changes needed?_
On case spark on kubernetes, spark using env `SPARK_USER_NAME` as user name.
So kyuubi should build spark engine with this env when proxy user or using keytab.
This conf only affect on kubernetes case.
Ref: apache/spark#23017
### _How was this patch tested?_
- [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
Closes#3527 from zwangsheng/feature/add_spark_user_name.
Closes#35279596372 [zwangsheng] only k8s case
ddd713f [zwangsheng] fix
48b9b22 [zwangsheng] add
Authored-by: zwangsheng <2213335496@qq.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
(cherry picked from commit 3738512)
Signed-off-by: Cheng Pan <chengpan@apache.org>
@pan3793

Copy link
Copy Markdown
Member

@zwangshengspark.kubernetes.executorEnv.[EnvironmentVariableName] does not take effect, the correct key is spark.executorEnv.[EnvironmentVariableName]
https://spark.apache.org/docs/latest/configuration.html

@zwangsheng

Copy link
Copy Markdown
ContributorAuthor

@zwangshengspark.kubernetes.executorEnv.[EnvironmentVariableName] does not take effect, the correct key is spark.executorEnv.[EnvironmentVariableName]https://spark.apache.org/docs/latest/configuration.html

😭sry, i will make follow PR.

pan3793 pushed a commit that referenced this pull request Oct 8, 2022
…e spark.executorEnv
### _Why are the changes needed?_
Fix bug in #3527
Modify `spark.kubernetes.executorEnv` to `spark.executorEnv`
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
- [x] Unit Test
Closes#3591 from zwangsheng/follow/SPARK_USER_NAME.
Closes#35277254fe9 [zwangsheng] fix executorEnv
Authored-by: zwangsheng <2213335496@qq.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
pan3793 pushed a commit that referenced this pull request Oct 8, 2022
…e spark.executorEnv
### _Why are the changes needed?_
Fix bug in #3527
Modify `spark.kubernetes.executorEnv` to `spark.executorEnv`
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
- [x] Unit Test
Closes#3591 from zwangsheng/follow/SPARK_USER_NAME.
Closes#35277254fe9 [zwangsheng] fix executorEnv
Authored-by: zwangsheng <2213335496@qq.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
(cherry picked from commit fb6516a)
Signed-off-by: Cheng Pan <chengpan@apache.org>
pan3793 pushed a commit that referenced this pull request Oct 20, 2022
…AME on submitting Spark batch job to K8s
### _Why are the changes needed?_
Batch job should also submit with `SPARK_USER_NAME`.
See more in pre pr #3527 .
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
Closes#3664 from zwangsheng/feature/batch_with_user_name.
Closes#366476dee3e [zwangsheng] style
0d40508 [zwangsheng] fix
a1fcf7f [zwangsheng] fix
Authored-by: zwangsheng <2213335496@qq.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
pan3793 pushed a commit that referenced this pull request Oct 20, 2022
…AME on submitting Spark batch job to K8s
### _Why are the changes needed?_
Batch job should also submit with `SPARK_USER_NAME`.
See more in pre pr #3527 .
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
Closes#3664 from zwangsheng/feature/batch_with_user_name.
Closes#366476dee3e [zwangsheng] style
0d40508 [zwangsheng] fix
a1fcf7f [zwangsheng] fix
Authored-by: zwangsheng <2213335496@qq.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
(cherry picked from commit 5f8b57b)
Signed-off-by: Cheng Pan <chengpan@apache.org>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@zwangsheng@codecov-commenter@pan3793@turboFei@yaooqinn