| @@ -12,7 +12,9 @@ import io.kubernetes.client.openapi.ApiException; | |||||
| import io.kubernetes.client.openapi.apis.AppsV1Api; | import io.kubernetes.client.openapi.apis.AppsV1Api; | ||||
| import io.kubernetes.client.openapi.apis.CoreV1Api; | import io.kubernetes.client.openapi.apis.CoreV1Api; | ||||
| import io.kubernetes.client.openapi.models.*; | import io.kubernetes.client.openapi.models.*; | ||||
| import io.kubernetes.client.util.ClientBuilder; | |||||
| import io.kubernetes.client.util.Config; | import io.kubernetes.client.util.Config; | ||||
| import io.kubernetes.client.util.credentials.AccessTokenAuthentication; | |||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.StringUtils; | ||||
| import org.json.JSONObject; | import org.json.JSONObject; | ||||
| @@ -61,10 +63,10 @@ public class K8sClientUtil { | |||||
| this.http = http; | this.http = http; | ||||
| this.token = token; | this.token = token; | ||||
| try { | 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) { | } catch (Exception e) { | ||||
| log.error("构建K8s-Client异常", e); | log.error("构建K8s-Client异常", e); | ||||
| throw new RuntimeException("构建K8s-Client异常"); | throw new RuntimeException("构建K8s-Client异常"); | ||||