From 0dd7163338d46e4d2daf472818d3d5b065b0f357 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 4 Nov 2024 10:29:00 +0800 Subject: [PATCH] =?UTF-8?q?k8s=E8=BF=98=E5=8E=9Ftoken=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/platform/utils/K8sClientUtil.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java index fc2fceaf..42de6d25 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java @@ -14,7 +14,9 @@ import io.kubernetes.client.openapi.ApiException; import io.kubernetes.client.openapi.apis.AppsV1Api; import io.kubernetes.client.openapi.apis.CoreV1Api; import io.kubernetes.client.openapi.models.*; +import io.kubernetes.client.util.ClientBuilder; import io.kubernetes.client.util.Config; +import io.kubernetes.client.util.credentials.AccessTokenAuthentication; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.json.JSONObject; @@ -63,10 +65,10 @@ public class K8sClientUtil { this.http = http; this.token = token; try { -// this.apiClient = new ClientBuilder(). -// setBasePath(http).setVerifyingSsl(false). -// setAuthentication(new AccessTokenAuthentication(token)).build(); - this.apiClient = Config.fromCluster(); + this.apiClient = new ClientBuilder(). + setBasePath(http).setVerifyingSsl(false). + setAuthentication(new AccessTokenAuthentication(token)).build(); +// this.apiClient = Config.fromCluster(); } catch (Exception e) { log.error("构建K8s-Client异常", e); throw new RuntimeException("构建K8s-Client异常");