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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]