|
|
|
@@ -1,13 +1,16 @@ |
|
|
|
package com.ruoyi.platform.utils; |
|
|
|
|
|
|
|
import com.alibaba.nacos.shaded.com.google.gson.reflect.TypeToken; |
|
|
|
import io.kubernetes.client.Exec; |
|
|
|
import io.kubernetes.client.custom.IntOrString; |
|
|
|
import io.kubernetes.client.custom.Quantity; |
|
|
|
import io.kubernetes.client.openapi.ApiClient; |
|
|
|
import io.kubernetes.client.openapi.ApiException; |
|
|
|
import io.kubernetes.client.openapi.ApiResponse; |
|
|
|
import io.kubernetes.client.openapi.apis.CoreV1Api; |
|
|
|
import io.kubernetes.client.openapi.models.*; |
|
|
|
import io.kubernetes.client.util.ClientBuilder; |
|
|
|
import io.kubernetes.client.util.Watch; |
|
|
|
import io.kubernetes.client.util.credentials.AccessTokenAuthentication; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
@@ -15,7 +18,6 @@ import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.io.BufferedReader; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStreamReader; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.LinkedHashMap; |
|
|
|
@@ -405,10 +407,11 @@ public class K8sClientUtil { |
|
|
|
public static String getPodLogs(String podName,String namespace,int line) { |
|
|
|
CoreV1Api api = new CoreV1Api(apiClient); |
|
|
|
try { |
|
|
|
String log = api.readNamespacedPodLog(podName, namespace, null, null, null, null, null,null, null, line, null); |
|
|
|
String log = api.readNamespacedPodLog(podName, namespace, null, null, null, null, null,null, null, line, null); |
|
|
|
return log; |
|
|
|
} catch (ApiException e) { |
|
|
|
throw new RuntimeException("获取Pod日志异常", e); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |