chore: 公共 DTO 增加资源池类型

This commit is contained in:
fit2-zhao 2024-10-08 15:51:01 +08:00 committed by Craftsman
parent 8be53b8b4e
commit a88a5e305b
4 changed files with 8 additions and 3 deletions

View File

@ -33,7 +33,7 @@ public class KubernetesExecEngine implements ApiEngine {
@Override @Override
public void execute(String command) { public void execute(String command) {
// 初始化任务 // 初始化任务
LogUtils.info("K8s 开始执行: {}", command); LogUtils.info("CURL 命令:【 " + command + "");
this.runApi(command); this.runApi(command);
} }

View File

@ -51,7 +51,7 @@ public class KubernetesProvider {
public static void exec(TestResourceDTO resource, Object runRequest, String command) { public static void exec(TestResourceDTO resource, Object runRequest, String command) {
try (KubernetesClient client = getKubernetesClient(resource)) { try (KubernetesClient client = getKubernetesClient(resource)) {
Pod pod = getExecPod(client, resource); Pod pod = getExecPod(client, resource);
LogUtils.info("CURL 命令:【 " + command + ""); LogUtils.info("当前执行 Pod" + pod.getMetadata().getName() + "");
client.pods().inNamespace(client.getNamespace()).withName(pod.getMetadata().getName()) client.pods().inNamespace(client.getNamespace()).withName(pod.getMetadata().getName())
.redirectingInput() .redirectingInput()
.writingOutput(System.out) .writingOutput(System.out)

View File

@ -593,7 +593,9 @@ public class ApiExecuteService {
!commonProjectService.validateProjectResourcePool(testResourcePool, projectId)) { !commonProjectService.validateProjectResourcePool(testResourcePool, projectId)) {
throw new MSException(ApiResultCode.EXECUTE_RESOURCE_POOL_NOT_CONFIG); throw new MSException(ApiResultCode.EXECUTE_RESOURCE_POOL_NOT_CONFIG);
} }
return testResourcePoolService.getTestResourcePoolDetail(resourcePoolId); TestResourcePoolReturnDTO poolReturnDTO = testResourcePoolService.getTestResourcePoolDetail(resourcePoolId);
poolReturnDTO.setType(testResourcePool.getType());
return poolReturnDTO;
} }
public String getProjectApiResourcePoolId(String projectId) { public String getProjectApiResourcePoolId(String projectId) {

View File

@ -10,6 +10,9 @@ import lombok.EqualsAndHashCode;
public class TestResourcePoolReturnDTO extends TestResourcePool { public class TestResourcePoolReturnDTO extends TestResourcePool {
private TestResourceReturnDTO testResourceReturnDTO; private TestResourceReturnDTO testResourceReturnDTO;
@Schema(description = "资源池类型, Node/Kubernetes")
private String type;
@Schema(description = "资源池是否在使用中") @Schema(description = "资源池是否在使用中")
private Boolean inUsed; private Boolean inUsed;
} }