You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "miaht94 (via GitHub)" <gi...@apache.org> on 2026/09/02 10:04:57 UTC
[PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
miaht94 opened a new pull request, #7710:
URL: https://github.com/apache/kyuubi/pull/7710
### Why are the changes needed?
When Kyuubi Server runs inside Kubernetes without
`kyuubi.kubernetes.client.initialize.list`, no Kubernetes client or informer is initialized
at startup. As a result, terminated Spark driver pods can remain after their retention period
even though cleanup is enabled.
Initialize the configured namespace automatically from the in-cluster environment while
preserving the explicit initialization list as the higher-priority configuration. Outside
Kubernetes, the existing empty-list behavior is unchanged.
The stale Guava-expiration behavior is already handled on `master` by #7220, so this patch
does not add the Caffeine dependency or unrelated Helm chart changes.
Closes #7293.
### How was this patch tested?
- `dev/gen/gen_all_config_docs.sh`
- `dev/reformat`
- `build/mvn test -pl kyuubi-server -am -Pspark-provided,hive-provided,flink-provided -Dtest=none -DwildcardSuites=org.apache.kyuubi.engine.KubernetesApplicationOperationSuite`
The focused suite covers no automatic initialization outside Kubernetes, automatic
in-cluster initialization for the configured namespace, and explicit-list precedence.
### Was this patch assisted by generative AI tooling?
Assisted-by: OpenAI Codex
--
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
Re: [PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
Posted by "miaht94 (via GitHub)" <gi...@apache.org>.
miaht94 commented on code in PR #7710:
URL: https://github.com/apache/kyuubi/pull/7710#discussion_r3915917536
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -217,14 +217,26 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
}
private[kyuubi] def getKubernetesClientInitializeInfo(
- kyuubiConf: KyuubiConf): Seq[KubernetesInfo] = {
- kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
- val (context, namespace) = init.split(":") match {
- case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
- case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
- case _ => (None, None)
+ kyuubiConf: KyuubiConf,
+ environment: Map[String, String] = sys.env): Seq[KubernetesInfo] = {
+ val configuredInitializeInfo =
+ kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
+ val (context, namespace) = init.split(":") match {
+ case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
+ case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
+ case _ => (None, None)
+ }
+ KubernetesInfo(context, namespace)
}
- KubernetesInfo(context, namespace)
+ if (configuredInitializeInfo.nonEmpty) {
+ configuredInitializeInfo
+ } else if (environment.contains(KUBERNETES_SERVICE_HOST) &&
+ environment.contains(KUBERNETES_SERVICE_PORT)) {
Review Comment:
Addressed in 5181e49. The fallback now requires non-empty Kubernetes service environment variables and readable service account token and CA files. The unit test also covers the missing-credential case.
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -217,14 +217,26 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
}
private[kyuubi] def getKubernetesClientInitializeInfo(
- kyuubiConf: KyuubiConf): Seq[KubernetesInfo] = {
- kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
- val (context, namespace) = init.split(":") match {
- case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
- case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
- case _ => (None, None)
+ kyuubiConf: KyuubiConf,
+ environment: Map[String, String] = sys.env): Seq[KubernetesInfo] = {
+ val configuredInitializeInfo =
+ kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
+ val (context, namespace) = init.split(":") match {
+ case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
+ case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
+ case _ => (None, None)
+ }
+ KubernetesInfo(context, namespace)
}
- KubernetesInfo(context, namespace)
+ if (configuredInitializeInfo.nonEmpty) {
+ configuredInitializeInfo
+ } else if (environment.contains(KUBERNETES_SERVICE_HOST) &&
+ environment.contains(KUBERNETES_SERVICE_PORT)) {
+ Seq(KubernetesInfo(
+ None,
+ Some(kyuubiConf.get(KyuubiConf.KUBERNETES_NAMESPACE))))
Review Comment:
Addressed in 5181e49. The configured namespace is now filtered consistently, so an empty value produces .
##########
kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala:
##########
@@ -1427,7 +1427,10 @@ object KyuubiConf {
.doc("The kubernetes client initialize list to register kubernetes resource informers" +
" during Kyuubi server startup. This ensure the Kyuubi server is promptly informed for" +
" any Kubernetes resource changes after startup. It is highly recommend to set it for" +
Review Comment:
Addressed in 5181e49, and the generated configuration documentation has been refreshed.
--
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
Re: [PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #7710:
URL: https://github.com/apache/kyuubi/pull/7710#discussion_r3916091177
##########
kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala:
##########
@@ -1425,9 +1425,12 @@ object KyuubiConf {
val KUBERNETES_CLIENT_INITIALIZE_LIST: ConfigEntry[Seq[String]] =
buildConf("kyuubi.kubernetes.client.initialize.list")
.doc("The kubernetes client initialize list to register kubernetes resource informers" +
- " during Kyuubi server startup. This ensure the Kyuubi server is promptly informed for" +
- " any Kubernetes resource changes after startup. It is highly recommend to set it for" +
- " multiple Kyuubi instances mode. The format is `context1:namespace1,context2:namespace2`.")
+ " during Kyuubi server startup. This ensures the Kyuubi server is promptly informed for" +
+ " any Kubernetes resource changes after startup. It is highly recommended to set it for" +
+ " multiple Kyuubi instances mode. The format is" +
+ " `context1:namespace1,context2:namespace2`." +
+ " When the list is empty and Kyuubi runs in Kubernetes, the client for the configured" +
+ " namespace is initialized automatically with the in-cluster configuration.")
Review Comment:
Since `kyuubi.kubernetes.namespace` now also selects the namespace watched by the auto-initialized in-cluster client, please fix its doc (`KUBERNETES_NAMESPACE`, above) in this PR - the current text "running the kyuubi pods" is misleading, as it has never controlled where the Kyuubi server runs. Suggestion:
```
The default namespace used by the Kyuubi server's Kubernetes client to discover and
manage engine pods, when the engine submission does not specify one (e.g.
`spark.kubernetes.namespace`). It does not control the namespace where the Kyuubi
server itself runs.
```
Remember to regenerate `settings.md` after the change.
##########
kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala:
##########
@@ -1425,9 +1425,12 @@ object KyuubiConf {
val KUBERNETES_CLIENT_INITIALIZE_LIST: ConfigEntry[Seq[String]] =
buildConf("kyuubi.kubernetes.client.initialize.list")
.doc("The kubernetes client initialize list to register kubernetes resource informers" +
- " during Kyuubi server startup. This ensure the Kyuubi server is promptly informed for" +
- " any Kubernetes resource changes after startup. It is highly recommend to set it for" +
- " multiple Kyuubi instances mode. The format is `context1:namespace1,context2:namespace2`.")
+ " during Kyuubi server startup. This ensures the Kyuubi server is promptly informed for" +
+ " any Kubernetes resource changes after startup. It is highly recommended to set it for" +
+ " multiple Kyuubi instances mode. The format is" +
+ " `context1:namespace1,context2:namespace2`." +
+ " When the list is empty and Kyuubi runs in Kubernetes, the client for the configured" +
+ " namespace is initialized automatically with the in-cluster configuration.")
.version("1.11.0")
Review Comment:
Note for other reviewers: this entry shipped in v1.10.2 via the branch-1.10 backport of KYUUBI #7027, though `version()` says 1.11.0 - pre-existing, not related to this PR.
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -217,14 +218,31 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
}
private[kyuubi] def getKubernetesClientInitializeInfo(
- kyuubiConf: KyuubiConf): Seq[KubernetesInfo] = {
- kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
- val (context, namespace) = init.split(":") match {
- case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
- case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
- case _ => (None, None)
+ kyuubiConf: KyuubiConf,
+ environment: Map[String, String] = sys.env,
+ serviceAccountTokenPath: Path = Paths.get(Config.KUBERNETES_SERVICE_ACCOUNT_TOKEN_PATH),
+ serviceAccountCaCertPath: Path = Paths.get(
+ Config.KUBERNETES_SERVICE_ACCOUNT_CA_CRT_PATH)): Seq[KubernetesInfo] = {
+ val configuredInitializeInfo =
+ kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
+ val (context, namespace) = init.split(":") match {
+ case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
+ case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
+ case _ => (None, None)
+ }
+ KubernetesInfo(context, namespace)
}
- KubernetesInfo(context, namespace)
+ if (configuredInitializeInfo.nonEmpty) {
+ configuredInitializeInfo
+ } else if (environment.get(KUBERNETES_SERVICE_HOST).exists(_.nonEmpty) &&
+ environment.get(KUBERNETES_SERVICE_PORT).exists(_.nonEmpty) &&
+ Files.isReadable(serviceAccountTokenPath) &&
+ Files.isReadable(serviceAccountCaCertPath)) {
+ Seq(KubernetesInfo(
+ None,
Review Comment:
Please add a brief comment that `context` is intentionally `None` here, since kube context is meaningless for in-cluster configuration.
--
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
Re: [PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7710:
URL: https://github.com/apache/kyuubi/pull/7710#discussion_r3915655378
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -217,14 +217,26 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
}
private[kyuubi] def getKubernetesClientInitializeInfo(
- kyuubiConf: KyuubiConf): Seq[KubernetesInfo] = {
- kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
- val (context, namespace) = init.split(":") match {
- case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
- case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
- case _ => (None, None)
+ kyuubiConf: KyuubiConf,
+ environment: Map[String, String] = sys.env): Seq[KubernetesInfo] = {
+ val configuredInitializeInfo =
+ kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
+ val (context, namespace) = init.split(":") match {
+ case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
+ case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
+ case _ => (None, None)
+ }
+ KubernetesInfo(context, namespace)
}
- KubernetesInfo(context, namespace)
+ if (configuredInitializeInfo.nonEmpty) {
+ configuredInitializeInfo
+ } else if (environment.contains(KUBERNETES_SERVICE_HOST) &&
+ environment.contains(KUBERNETES_SERVICE_PORT)) {
Review Comment:
The in-cluster detection relies solely on the presence of `KUBERNETES_SERVICE_HOST`/`KUBERNETES_SERVICE_PORT`. If these env vars are injected/set in a non-Kubernetes runtime, Kyuubi will treat the environment as in-cluster and attempt in-cluster initialization unexpectedly. A more robust check is to also validate a standard in-cluster signal (e.g., presence/readability of the service account token/CA files under `/var/run/secrets/kubernetes.io/serviceaccount/`) before enabling the fallback.
##########
kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala:
##########
@@ -1427,7 +1427,10 @@ object KyuubiConf {
.doc("The kubernetes client initialize list to register kubernetes resource informers" +
" during Kyuubi server startup. This ensure the Kyuubi server is promptly informed for" +
" any Kubernetes resource changes after startup. It is highly recommend to set it for" +
Review Comment:
Grammar fixes in the updated doc string: change 'This ensure' to 'This ensures', and 'highly recommend' to 'highly recommended'. Since this text is surfaced into generated docs, correcting it here will improve user-facing documentation.
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -217,14 +217,26 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
}
private[kyuubi] def getKubernetesClientInitializeInfo(
- kyuubiConf: KyuubiConf): Seq[KubernetesInfo] = {
- kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
- val (context, namespace) = init.split(":") match {
- case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
- case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
- case _ => (None, None)
+ kyuubiConf: KyuubiConf,
+ environment: Map[String, String] = sys.env): Seq[KubernetesInfo] = {
+ val configuredInitializeInfo =
+ kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
+ val (context, namespace) = init.split(":") match {
+ case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
+ case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
+ case _ => (None, None)
+ }
+ KubernetesInfo(context, namespace)
}
- KubernetesInfo(context, namespace)
+ if (configuredInitializeInfo.nonEmpty) {
+ configuredInitializeInfo
+ } else if (environment.contains(KUBERNETES_SERVICE_HOST) &&
+ environment.contains(KUBERNETES_SERVICE_PORT)) {
+ Seq(KubernetesInfo(
+ None,
+ Some(kyuubiConf.get(KyuubiConf.KUBERNETES_NAMESPACE))))
Review Comment:
In the in-cluster fallback branch, the namespace is wrapped with `Some(...)` without filtering empty strings. If `kyuubi.kubernetes.namespace` is set to an empty string, this will produce `Some(\"\")`, which is inconsistent with the explicit-list parsing (which filters empty values) and can lead to invalid/undesired informer initialization. Consider applying the same `filterNot(_.isEmpty)` logic here (or constructing the `Option` via filtering) so the behavior is consistent.
--
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
Re: [PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #7710:
URL: https://github.com/apache/kyuubi/pull/7710#issuecomment-5519387301
LGTM
--
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
Re: [PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
Posted by "miaht94 (via GitHub)" <gi...@apache.org>.
miaht94 commented on code in PR #7710:
URL: https://github.com/apache/kyuubi/pull/7710#discussion_r3915918247
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -217,14 +217,26 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
}
private[kyuubi] def getKubernetesClientInitializeInfo(
- kyuubiConf: KyuubiConf): Seq[KubernetesInfo] = {
- kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
- val (context, namespace) = init.split(":") match {
- case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
- case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
- case _ => (None, None)
+ kyuubiConf: KyuubiConf,
+ environment: Map[String, String] = sys.env): Seq[KubernetesInfo] = {
+ val configuredInitializeInfo =
+ kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
+ val (context, namespace) = init.split(":") match {
+ case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
+ case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
+ case _ => (None, None)
+ }
+ KubernetesInfo(context, namespace)
}
- KubernetesInfo(context, namespace)
+ if (configuredInitializeInfo.nonEmpty) {
+ configuredInitializeInfo
+ } else if (environment.contains(KUBERNETES_SERVICE_HOST) &&
+ environment.contains(KUBERNETES_SERVICE_PORT)) {
+ Seq(KubernetesInfo(
+ None,
+ Some(kyuubiConf.get(KyuubiConf.KUBERNETES_NAMESPACE))))
Review Comment:
Addressed in 5181e49. The configured namespace is now filtered consistently, so an empty value produces no namespace override.
--
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
Re: [PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #7710:
URL: https://github.com/apache/kyuubi/pull/7710#issuecomment-5521703570
**Merge Summary:**
- merged into master https://github.com/apache/kyuubi/commit/5c80e74bcef6727356d2996de6f4bf792bdff1cc
*Posted by `merge_kyuubi_pr.py`*
--
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
Re: [PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
Posted by "wangzhigang1999 (via GitHub)" <gi...@apache.org>.
wangzhigang1999 commented on PR #7710:
URL: https://github.com/apache/kyuubi/pull/7710#issuecomment-5512394028
Thanks for the quick update, and sorry for the churn. I should have caught these issues before your update.
The RBAC and grammar changes look good. Could you revert the other two changes?
- Requiring the standard token and CA files is too restrictive. `KubernetesUtils` already supports configured authentication, and this check would silently skip initialization for those setups. Keeping the non-empty environment checks is enough.
- Filtering an empty namespace to `None` does not fix it because `getKubernetesConf` retains the original empty value. Namespace validation should be handled in the config entry if needed.
Sorry again for the extra work.
--
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
Re: [PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
Posted by "miaht94 (via GitHub)" <gi...@apache.org>.
miaht94 commented on code in PR #7710:
URL: https://github.com/apache/kyuubi/pull/7710#discussion_r3917485875
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -217,14 +217,27 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
}
private[kyuubi] def getKubernetesClientInitializeInfo(
- kyuubiConf: KyuubiConf): Seq[KubernetesInfo] = {
- kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
- val (context, namespace) = init.split(":") match {
- case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
- case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
- case _ => (None, None)
+ kyuubiConf: KyuubiConf,
+ environment: Map[String, String] = sys.env): Seq[KubernetesInfo] = {
+ val configuredInitializeInfo =
+ kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
+ val (context, namespace) = init.split(":") match {
+ case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
+ case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
+ case _ => (None, None)
+ }
+ KubernetesInfo(context, namespace)
}
- KubernetesInfo(context, namespace)
+ if (configuredInitializeInfo.nonEmpty) {
+ configuredInitializeInfo
+ } else if (environment.get(KUBERNETES_SERVICE_HOST).exists(_.nonEmpty) &&
Review Comment:
Thanks for pointing it out, i've fixed all the chores above in: https://github.com/apache/kyuubi/pull/7710/changes/46f4649af3fd291c7da27c2efa48efeaba0c3a78
Also changed + reused `Utils.isOnK8s` in: https://github.com/apache/kyuubi/pull/7710/changes/cc3e487994367a704e6c951c0e069d1aef19e1fc
--
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
Re: [PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
Posted by "miaht94 (via GitHub)" <gi...@apache.org>.
miaht94 commented on PR #7710:
URL: https://github.com/apache/kyuubi/pull/7710#issuecomment-5512250273
Thanks for the review. Addressed in 5181e49: the default Helm Role now grants pod create/list/watch/delete and service list/watch permissions. I validated the chart with Helm lint and inspected the rendered Role. I also strengthened in-cluster detection to require readable service account credentials, handled an empty namespace consistently, and refreshed the configuration documentation.
--
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
Re: [PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #7710:
URL: https://github.com/apache/kyuubi/pull/7710#discussion_r3917374728
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -217,14 +217,27 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
}
private[kyuubi] def getKubernetesClientInitializeInfo(
- kyuubiConf: KyuubiConf): Seq[KubernetesInfo] = {
- kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
- val (context, namespace) = init.split(":") match {
- case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
- case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
- case _ => (None, None)
+ kyuubiConf: KyuubiConf,
+ environment: Map[String, String] = sys.env): Seq[KubernetesInfo] = {
+ val configuredInitializeInfo =
+ kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
+ val (context, namespace) = init.split(":") match {
+ case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
+ case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
+ case _ => (None, None)
+ }
+ KubernetesInfo(context, namespace)
}
- KubernetesInfo(context, namespace)
+ if (configuredInitializeInfo.nonEmpty) {
+ configuredInitializeInfo
+ } else if (environment.get(KUBERNETES_SERVICE_HOST).exists(_.nonEmpty) &&
Review Comment:
One more thought: `kyuubi-common` already has `Utils.isOnK8s`, but it checks `/var/run/secrets/kubernetes.io`, which under-detects pods running with `automountServiceAccountToken: false`. The env-var check you use here matches client-go's `rest.InClusterConfig()` semantics (kubelet always injects `KUBERNETES_SERVICE_HOST`/`PORT`, even with `enableServiceLinks: false`), so it is the more authoritative signal.
Could you fix `Utils.isOnK8s` to use the env-var check and reuse it here? For testability, add an env parameter:
```scala
def isOnK8s(env: Map[String, String] = sys.env): Boolean =
env.get("KUBERNETES_SERVICE_HOST").exists(_.nonEmpty) &&
env.get("KUBERNETES_SERVICE_PORT").exists(_.nonEmpty)
```
This also makes the existing caller in `SparkSQLEngine` (prefer-IP registration, KYUUBI #3597 (1.7.0)) behave correctly when automount is disabled.
--
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
Re: [PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
Posted by "miaht94 (via GitHub)" <gi...@apache.org>.
miaht94 commented on PR #7710:
URL: https://github.com/apache/kyuubi/pull/7710#issuecomment-5509398775
@pan3793 Hi, would you mind reviewing this PR?
--
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
Re: [PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
Posted by "miaht94 (via GitHub)" <gi...@apache.org>.
miaht94 commented on code in PR #7710:
URL: https://github.com/apache/kyuubi/pull/7710#discussion_r3917936977
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -217,14 +217,27 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
}
private[kyuubi] def getKubernetesClientInitializeInfo(
- kyuubiConf: KyuubiConf): Seq[KubernetesInfo] = {
- kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
- val (context, namespace) = init.split(":") match {
- case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
- case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
- case _ => (None, None)
+ kyuubiConf: KyuubiConf,
+ environment: Map[String, String] = sys.env): Seq[KubernetesInfo] = {
+ val configuredInitializeInfo =
+ kyuubiConf.get(KyuubiConf.KUBERNETES_CLIENT_INITIALIZE_LIST).map { init =>
+ val (context, namespace) = init.split(":") match {
+ case Array(ctx, ns) => (Some(ctx).filterNot(_.isEmpty), Some(ns).filterNot(_.isEmpty))
+ case Array(ctx) => (Some(ctx).filterNot(_.isEmpty), None)
+ case _ => (None, None)
+ }
+ KubernetesInfo(context, namespace)
}
- KubernetesInfo(context, namespace)
+ if (configuredInitializeInfo.nonEmpty) {
+ configuredInitializeInfo
+ } else if (environment.get(KUBERNETES_SERVICE_HOST).exists(_.nonEmpty) &&
Review Comment:
I've corrected the syntax errors in the `isOnK8s` call site; could you please trigger the integration CI?
--
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
Re: [PR] [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically [kyuubi]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 closed pull request #7710: [KYUUBI #7293][KUBERNETES] Initialize in-cluster client automatically
URL: https://github.com/apache/kyuubi/pull/7710
--
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