From a01040f949856a98cd51f67efd8cfa32ffc67d74 Mon Sep 17 00:00:00 2001 From: "Wang, Fei" Date: Thu, 9 Jan 2025 10:07:16 +0800 Subject: [PATCH] withOauthTokenProvider --- .../main/scala/org/apache/kyuubi/util/KubernetesUtils.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/util/KubernetesUtils.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/util/KubernetesUtils.scala index 02b52f9266e..1d2e0259665 100644 --- a/kyuubi-server/src/main/scala/org/apache/kyuubi/util/KubernetesUtils.scala +++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/util/KubernetesUtils.scala @@ -23,7 +23,7 @@ import java.util.Locale import com.fasterxml.jackson.databind.ObjectMapper import com.google.common.base.Charsets import com.google.common.io.Files -import io.fabric8.kubernetes.client.{Config, ConfigBuilder, KubernetesClient, KubernetesClientBuilder} +import io.fabric8.kubernetes.client.{Config, ConfigBuilder, KubernetesClient, KubernetesClientBuilder, OAuthTokenProvider} import io.fabric8.kubernetes.client.Config.autoConfigure import io.fabric8.kubernetes.client.okhttp.OkHttpClientFactory import okhttp3.{Dispatcher, OkHttpClient} @@ -78,7 +78,9 @@ object KubernetesUtils extends Logging { .withOption(oauthTokenValue) { (token, configBuilder) => configBuilder.withOauthToken(token) }.withOption(oauthTokenFile) { (file, configBuilder) => - configBuilder.withOauthToken(Files.asCharSource(file, Charsets.UTF_8).read()) + configBuilder.withOauthTokenProvider(new OAuthTokenProvider { + override def getToken: String = Files.asCharSource(file, Charsets.UTF_8).read() + }) }.withOption(caCertFile) { (file, configBuilder) => configBuilder.withCaCertFile(file) }.withOption(clientKeyFile) { (file, configBuilder) =>