You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "pan3793 (via GitHub)" <gi...@apache.org> on 2023/09/18 13:03:55 UTC
[GitHub] [kyuubi] pan3793 opened a new pull request, #5306: ApplicationManager supports proxy user
pan3793 opened a new pull request, #5306:
URL: https://github.com/apache/kyuubi/pull/5306
<!--
Thanks for sending a pull request!
Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/CONTRIBUTING.html
2. If the PR is related to an issue in https://github.com/apache/kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
-->
### _Why are the changes needed?_
<!--
Please clarify why the changes are needed. For instance,
1. If you add a feature, you can talk about the use case of it.
2. If you fix a bug, you can clarify why it is a bug.
-->
For the secured YARN cluster, the Kyuubi Server's user typically has no permission to kill the application. Proxy user or admin should be used instead.
### _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.readthedocs.io/en/master/contributing/code/testing.html#running-tests) locally before make a pull request
### _Was this patch authored or co-authored using generative AI tooling?_
<!--
If a generative AI tooling has been used in the process of authoring this patch, please include
phrase 'Generated-by: ' followed by the name of the tool and its version.
If no, write 'No'.
Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
-->
No.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] pan3793 commented on a diff in pull request #5306: ApplicationManager supports proxy user
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #5306:
URL: https://github.com/apache/kyuubi/pull/5306#discussion_r1329531805
##########
kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala:
##########
@@ -2826,6 +2826,32 @@ object KyuubiConf {
.version("1.7.2")
.fallbackConf(ENGINE_SUBMIT_TIMEOUT)
+ object YARNClientProxyUserStrategy extends Enumeration {
+ type YARNClientProxyUser = Value
+ val NONE, ADMIN, OWNER = Value
+ }
+
+ val YARN_PROXY_USER_STRATEGY: ConfigEntry[String] =
+ buildConf("kyuubi.yarn.proxyUser.strategy")
Review Comment:
I'm open to the configuration name, but there are existing `kyuubi.kubernetes.xxx` without `client` namespace too.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] pan3793 commented on a diff in pull request #5306: ApplicationManager supports proxy user
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #5306:
URL: https://github.com/apache/kyuubi/pull/5306#discussion_r1329737512
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/YarnApplicationOperation.scala:
##########
@@ -21,118 +21,144 @@ import java.util.Locale
import scala.collection.JavaConverters._
+import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.yarn.api.records.{FinalApplicationStatus, YarnApplicationState}
import org.apache.hadoop.yarn.client.api.YarnClient
-import org.apache.kyuubi.Logging
+import org.apache.kyuubi.{Logging, Utils}
import org.apache.kyuubi.config.KyuubiConf
+import org.apache.kyuubi.config.KyuubiConf.YARNClientProxyUserStrategy
+import org.apache.kyuubi.config.KyuubiConf.YARNClientProxyUserStrategy._
import org.apache.kyuubi.engine.ApplicationOperation._
import org.apache.kyuubi.engine.ApplicationState.ApplicationState
import org.apache.kyuubi.engine.YarnApplicationOperation.toApplicationState
import org.apache.kyuubi.util.KyuubiHadoopUtils
class YarnApplicationOperation extends ApplicationOperation with Logging {
- @volatile private var yarnClient: YarnClient = _
+ private var yarnConf: Configuration = _
+ @volatile private var adminYarnClient: Option[YarnClient] = None
private var submitTimeout: Long = _
override def initialize(conf: KyuubiConf): Unit = {
submitTimeout = conf.get(KyuubiConf.ENGINE_YARN_SUBMIT_TIMEOUT)
- val yarnConf = KyuubiHadoopUtils.newYarnConfiguration(conf)
- // YarnClient is thread-safe
- val c = YarnClient.createYarnClient()
- c.init(yarnConf)
- c.start()
- yarnClient = c
- info(s"Successfully initialized yarn client: ${c.getServiceState}")
+ yarnConf = KyuubiHadoopUtils.newYarnConfiguration(conf)
+
+ YARNClientProxyUserStrategy.withName(conf.get(KyuubiConf.YARN_PROXY_USER_STRATEGY)) match {
+ case NONE =>
+ val c = createYarnClient(yarnConf)
+ info(s"Successfully initialized admin YARN client.")
+ adminYarnClient = Some(c)
+ case ADMIN =>
+ val adminUser = conf.get(KyuubiConf.YARN_PROXY_USER_ADMIN_USER).getOrElse(Utils.currentUser)
+ Utils.doAs(adminUser) { () =>
Review Comment:
updated
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] codecov-commenter commented on pull request #5306: ApplicationManager supports proxy user
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #5306:
URL: https://github.com/apache/kyuubi/pull/5306#issuecomment-1724863783
## [Codecov](https://app.codecov.io/gh/apache/kyuubi/pull/5306?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
> Merging [#5306](https://app.codecov.io/gh/apache/kyuubi/pull/5306?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (bf0057b) into [master](https://app.codecov.io/gh/apache/kyuubi/commit/2732449d3ab378f061f75a25cda32d7cdc4a5f78?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (2732449) will **not change** coverage.
> The diff coverage is `0.00%`.
```diff
@@ Coverage Diff @@
## master #5306 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 590 590
Lines 33372 33421 +49
Branches 4415 4421 +6
======================================
- Misses 33372 33421 +49
```
| [Files Changed](https://app.codecov.io/gh/apache/kyuubi/pull/5306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...ommon/src/main/scala/org/apache/kyuubi/Utils.scala](https://app.codecov.io/gh/apache/kyuubi/pull/5306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLWNvbW1vbi9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9VdGlscy5zY2FsYQ==) | `0.00% <0.00%> (ø)` | |
| [...in/scala/org/apache/kyuubi/config/KyuubiConf.scala](https://app.codecov.io/gh/apache/kyuubi/pull/5306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLWNvbW1vbi9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jb25maWcvS3l1dWJpQ29uZi5zY2FsYQ==) | `0.00% <0.00%> (ø)` | |
| [...rg/apache/kyuubi/engine/ApplicationOperation.scala](https://app.codecov.io/gh/apache/kyuubi/pull/5306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvQXBwbGljYXRpb25PcGVyYXRpb24uc2NhbGE=) | `0.00% <0.00%> (ø)` | |
| [...ain/scala/org/apache/kyuubi/engine/EngineRef.scala](https://app.codecov.io/gh/apache/kyuubi/pull/5306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvRW5naW5lUmVmLnNjYWxh) | `0.00% <0.00%> (ø)` | |
| [...apache/kyuubi/engine/JpsApplicationOperation.scala](https://app.codecov.io/gh/apache/kyuubi/pull/5306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvSnBzQXBwbGljYXRpb25PcGVyYXRpb24uc2NhbGE=) | `0.00% <0.00%> (ø)` | |
| [...kyuubi/engine/KubernetesApplicationOperation.scala](https://app.codecov.io/gh/apache/kyuubi/pull/5306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvS3ViZXJuZXRlc0FwcGxpY2F0aW9uT3BlcmF0aW9uLnNjYWxh) | `0.00% <0.00%> (ø)` | |
| [...pache/kyuubi/engine/KyuubiApplicationManager.scala](https://app.codecov.io/gh/apache/kyuubi/pull/5306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvS3l1dWJpQXBwbGljYXRpb25NYW5hZ2VyLnNjYWxh) | `0.00% <0.00%> (ø)` | |
| [...pache/kyuubi/engine/YarnApplicationOperation.scala](https://app.codecov.io/gh/apache/kyuubi/pull/5306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvWWFybkFwcGxpY2F0aW9uT3BlcmF0aW9uLnNjYWxh) | `0.00% <0.00%> (ø)` | |
| [...g/apache/kyuubi/operation/BatchJobSubmission.scala](https://app.codecov.io/gh/apache/kyuubi/pull/5306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9vcGVyYXRpb24vQmF0Y2hKb2JTdWJtaXNzaW9uLnNjYWxh) | `0.00% <0.00%> (ø)` | |
| [.../apache/kyuubi/server/api/v1/BatchesResource.scala](https://app.codecov.io/gh/apache/kyuubi/pull/5306?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvYXBpL3YxL0JhdGNoZXNSZXNvdXJjZS5zY2FsYQ==) | `0.00% <0.00%> (ø)` | |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] pan3793 commented on a diff in pull request #5306: ApplicationManager supports proxy user
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #5306:
URL: https://github.com/apache/kyuubi/pull/5306#discussion_r1329743545
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/YarnApplicationOperation.scala:
##########
@@ -21,118 +21,144 @@ import java.util.Locale
import scala.collection.JavaConverters._
+import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.yarn.api.records.{FinalApplicationStatus, YarnApplicationState}
import org.apache.hadoop.yarn.client.api.YarnClient
-import org.apache.kyuubi.Logging
+import org.apache.kyuubi.{Logging, Utils}
import org.apache.kyuubi.config.KyuubiConf
+import org.apache.kyuubi.config.KyuubiConf.YARNClientProxyUserStrategy
+import org.apache.kyuubi.config.KyuubiConf.YARNClientProxyUserStrategy._
import org.apache.kyuubi.engine.ApplicationOperation._
import org.apache.kyuubi.engine.ApplicationState.ApplicationState
import org.apache.kyuubi.engine.YarnApplicationOperation.toApplicationState
import org.apache.kyuubi.util.KyuubiHadoopUtils
class YarnApplicationOperation extends ApplicationOperation with Logging {
- @volatile private var yarnClient: YarnClient = _
+ private var yarnConf: Configuration = _
+ @volatile private var adminYarnClient: Option[YarnClient] = None
private var submitTimeout: Long = _
override def initialize(conf: KyuubiConf): Unit = {
submitTimeout = conf.get(KyuubiConf.ENGINE_YARN_SUBMIT_TIMEOUT)
- val yarnConf = KyuubiHadoopUtils.newYarnConfiguration(conf)
- // YarnClient is thread-safe
- val c = YarnClient.createYarnClient()
- c.init(yarnConf)
- c.start()
- yarnClient = c
- info(s"Successfully initialized yarn client: ${c.getServiceState}")
+ yarnConf = KyuubiHadoopUtils.newYarnConfiguration(conf)
+
+ YARNClientProxyUserStrategy.withName(conf.get(KyuubiConf.YARN_PROXY_USER_STRATEGY)) match {
+ case NONE =>
+ val c = createYarnClient(yarnConf)
+ info(s"Successfully initialized admin YARN client.")
+ adminYarnClient = Some(c)
+ case ADMIN =>
+ val adminUser = conf.get(KyuubiConf.YARN_PROXY_USER_ADMIN_USER).getOrElse(Utils.currentUser)
+ Utils.doAs(adminUser) { () =>
+ val c = createYarnClient(yarnConf)
+ info(s"Successfully initialized admin YARN client with user: $adminUser.")
+ adminYarnClient = Some(c)
+ }
+ case OWNER =>
+ info("Skip initializing admin YARN client")
+ }
}
- override def isSupported(appMgrInfo: ApplicationManagerInfo): Boolean = {
- yarnClient != null && appMgrInfo.resourceManager.exists(
- _.toLowerCase(Locale.ROOT).startsWith("yarn"))
+ private def createYarnClient(_yarnConf: Configuration): YarnClient = {
Review Comment:
fixed
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] zhouyifan279 commented on a diff in pull request #5306: ApplicationManager supports proxy user
Posted by "zhouyifan279 (via GitHub)" <gi...@apache.org>.
zhouyifan279 commented on code in PR #5306:
URL: https://github.com/apache/kyuubi/pull/5306#discussion_r1329520088
##########
kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala:
##########
@@ -2826,6 +2826,32 @@ object KyuubiConf {
.version("1.7.2")
.fallbackConf(ENGINE_SUBMIT_TIMEOUT)
+ object YARNClientProxyUserStrategy extends Enumeration {
+ type YARNClientProxyUser = Value
+ val NONE, ADMIN, OWNER = Value
+ }
+
+ val YARN_PROXY_USER_STRATEGY: ConfigEntry[String] =
+ buildConf("kyuubi.yarn.proxyUser.strategy")
Review Comment:
How about `kyuubi.yarn.client.proxyUser.xxx` ?
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] pan3793 commented on pull request #5306: [KYUUBI #5306] YarnApplicationOperation supports proxy user
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #5306:
URL: https://github.com/apache/kyuubi/pull/5306#issuecomment-1726831758
Thanks, merged to master/1.8
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] pan3793 closed pull request #5306: [KYUUBI #5306] YarnApplicationOperation supports proxy user
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 closed pull request #5306: [KYUUBI #5306] YarnApplicationOperation supports proxy user
URL: https://github.com/apache/kyuubi/pull/5306
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] cxzl25 commented on a diff in pull request #5306: ApplicationManager supports proxy user
Posted by "cxzl25 (via GitHub)" <gi...@apache.org>.
cxzl25 commented on code in PR #5306:
URL: https://github.com/apache/kyuubi/pull/5306#discussion_r1329560578
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/YarnApplicationOperation.scala:
##########
@@ -21,118 +21,144 @@ import java.util.Locale
import scala.collection.JavaConverters._
+import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.yarn.api.records.{FinalApplicationStatus, YarnApplicationState}
import org.apache.hadoop.yarn.client.api.YarnClient
-import org.apache.kyuubi.Logging
+import org.apache.kyuubi.{Logging, Utils}
import org.apache.kyuubi.config.KyuubiConf
+import org.apache.kyuubi.config.KyuubiConf.YARNClientProxyUserStrategy
+import org.apache.kyuubi.config.KyuubiConf.YARNClientProxyUserStrategy._
import org.apache.kyuubi.engine.ApplicationOperation._
import org.apache.kyuubi.engine.ApplicationState.ApplicationState
import org.apache.kyuubi.engine.YarnApplicationOperation.toApplicationState
import org.apache.kyuubi.util.KyuubiHadoopUtils
class YarnApplicationOperation extends ApplicationOperation with Logging {
- @volatile private var yarnClient: YarnClient = _
+ private var yarnConf: Configuration = _
+ @volatile private var adminYarnClient: Option[YarnClient] = None
private var submitTimeout: Long = _
override def initialize(conf: KyuubiConf): Unit = {
submitTimeout = conf.get(KyuubiConf.ENGINE_YARN_SUBMIT_TIMEOUT)
- val yarnConf = KyuubiHadoopUtils.newYarnConfiguration(conf)
- // YarnClient is thread-safe
- val c = YarnClient.createYarnClient()
- c.init(yarnConf)
- c.start()
- yarnClient = c
- info(s"Successfully initialized yarn client: ${c.getServiceState}")
+ yarnConf = KyuubiHadoopUtils.newYarnConfiguration(conf)
+
+ YARNClientProxyUserStrategy.withName(conf.get(KyuubiConf.YARN_PROXY_USER_STRATEGY)) match {
+ case NONE =>
+ val c = createYarnClient(yarnConf)
+ info(s"Successfully initialized admin YARN client.")
+ adminYarnClient = Some(c)
+ case ADMIN =>
+ val adminUser = conf.get(KyuubiConf.YARN_PROXY_USER_ADMIN_USER).getOrElse(Utils.currentUser)
+ Utils.doAs(adminUser) { () =>
+ val c = createYarnClient(yarnConf)
+ info(s"Successfully initialized admin YARN client with user: $adminUser.")
+ adminYarnClient = Some(c)
+ }
+ case OWNER =>
+ info("Skip initializing admin YARN client")
+ }
}
- override def isSupported(appMgrInfo: ApplicationManagerInfo): Boolean = {
- yarnClient != null && appMgrInfo.resourceManager.exists(
- _.toLowerCase(Locale.ROOT).startsWith("yarn"))
+ private def createYarnClient(_yarnConf: Configuration): YarnClient = {
Review Comment:
`_yarnConf` not used.
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/YarnApplicationOperation.scala:
##########
@@ -21,118 +21,144 @@ import java.util.Locale
import scala.collection.JavaConverters._
+import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.yarn.api.records.{FinalApplicationStatus, YarnApplicationState}
import org.apache.hadoop.yarn.client.api.YarnClient
-import org.apache.kyuubi.Logging
+import org.apache.kyuubi.{Logging, Utils}
import org.apache.kyuubi.config.KyuubiConf
+import org.apache.kyuubi.config.KyuubiConf.YARNClientProxyUserStrategy
+import org.apache.kyuubi.config.KyuubiConf.YARNClientProxyUserStrategy._
import org.apache.kyuubi.engine.ApplicationOperation._
import org.apache.kyuubi.engine.ApplicationState.ApplicationState
import org.apache.kyuubi.engine.YarnApplicationOperation.toApplicationState
import org.apache.kyuubi.util.KyuubiHadoopUtils
class YarnApplicationOperation extends ApplicationOperation with Logging {
- @volatile private var yarnClient: YarnClient = _
+ private var yarnConf: Configuration = _
+ @volatile private var adminYarnClient: Option[YarnClient] = None
private var submitTimeout: Long = _
override def initialize(conf: KyuubiConf): Unit = {
submitTimeout = conf.get(KyuubiConf.ENGINE_YARN_SUBMIT_TIMEOUT)
- val yarnConf = KyuubiHadoopUtils.newYarnConfiguration(conf)
- // YarnClient is thread-safe
- val c = YarnClient.createYarnClient()
- c.init(yarnConf)
- c.start()
- yarnClient = c
- info(s"Successfully initialized yarn client: ${c.getServiceState}")
+ yarnConf = KyuubiHadoopUtils.newYarnConfiguration(conf)
+
+ YARNClientProxyUserStrategy.withName(conf.get(KyuubiConf.YARN_PROXY_USER_STRATEGY)) match {
+ case NONE =>
+ val c = createYarnClient(yarnConf)
+ info(s"Successfully initialized admin YARN client.")
+ adminYarnClient = Some(c)
+ case ADMIN =>
+ val adminUser = conf.get(KyuubiConf.YARN_PROXY_USER_ADMIN_USER).getOrElse(Utils.currentUser)
+ Utils.doAs(adminUser) { () =>
Review Comment:
We don't need to create a proxy user if the users are the same.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] pan3793 commented on pull request #5306: ApplicationManager supports proxy user
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #5306:
URL: https://github.com/apache/kyuubi/pull/5306#issuecomment-1723432831
Also cc @zhouyifan279
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [kyuubi] pan3793 commented on pull request #5306: [KYUUBI #5306] YarnApplicationOperation supports proxy user
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #5306:
URL: https://github.com/apache/kyuubi/pull/5306#issuecomment-1726813136
The last commit renames the configurations
- `kyuubi.yarn.proxyUser.strategy` => `kyuubi.yarn.user.strategy`
- `kyuubi.yarn.proxyUser.adminUser` => `kyuubi.yarn.user.admmin`
And changes the default value of `kyuubi.yarn.user.admmin` from `None` to `"yarn"`
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org