[ Cmii ] [ Octopus ] - optimize octopus procedure

This commit is contained in:
zeaslity
2024-01-31 17:46:58 +08:00
parent 04e2712d9c
commit a83e7da008
11 changed files with 157 additions and 108 deletions

View File

@@ -1,5 +1,6 @@
package io.wdd.server.func;
import io.wdd.func.auto.beans.BaseFunctionEnum;
import io.wdd.func.auto.beans.ProjectDeployContext;
import io.wdd.func.auto.service.AppFuncScheduler;
import io.wdd.func.auto.service.BaseFuncScheduler;
@@ -13,6 +14,8 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@SpringBootTest
@@ -38,8 +41,9 @@ public class TestBaseFuncScheduler {
ProjectDeployContext projectDeployContext = new ProjectDeployContext();
Long projectServerId = 1751084188582440961L;// cqga
// Long projectServerId = 1751084188582440961L;// cqga
// Long projectServerId = 1722453318596550657L;// lappro
Long projectServerId = 1752602668144975873L;// cqlyj
projectDeployContext.setProjectId(projectServerId);
@@ -57,17 +61,17 @@ public class TestBaseFuncScheduler {
// .getRecords()
// .get(0);
String serverName = "Chongqing-amd64-01"; // cgga
// String serverName = "Chengdu-amd64-99"; // lap pro
String masterNodeServerName = "Chongqing-amd64-01"; // cgga
// String masterNodeServerName = "Chengdu-amd64-99"; // lap pro
ProjectServerVO projectServerVO = coreProjectServerService.projectServerOne(projectServerId);
Optional<ServerInfoPO> serverInfoPOOptional = projectServerVO.getBindingServerList().stream().filter(
serverInfoPO -> StringUtils.contains(serverInfoPO.getServerName(), serverName)
serverInfoPO -> StringUtils.contains(serverInfoPO.getServerName(), masterNodeServerName)
).findFirst();
if (serverInfoPOOptional.isEmpty()) {
System.out.printf("project of %s server of %s is empty", projectServerVO, serverName);
System.out.printf("project of %s server of %s is empty", projectServerVO, masterNodeServerName);
return;
}
@@ -75,22 +79,42 @@ public class TestBaseFuncScheduler {
System.out.println("serverInfoPO = " + serverInfoPO);
projectDeployContext.setMasterNode(serverInfoPO);
ArrayList<ServerInfoPO> agentNodeList = new ArrayList<>();
// baseFuncScheduler.runProcedure(projectDeployContext);
projectServerVO.getBindingServerList().forEach(
po -> {
if (!StringUtils.contains(po.getServerName(), masterNodeServerName)) {
agentNodeList.add(po);
}
}
);
projectDeployContext.setAgentNodeList(agentNodeList);
List<BaseFunctionEnum> masterNodeProcedure = List.of(
// BaseFunctionEnum.INSTALL_DOCKER,
BaseFunctionEnum.INSTALL_DOCKER_COMPOSE,
BaseFunctionEnum.MODIFY_DOCKER_CONFIG,
BaseFunctionEnum.INSTALL_HARBOR
);
List<BaseFunctionEnum> agentNodeProcedure = List.of(
BaseFunctionEnum.DISABLE_SWAP,
BaseFunctionEnum.SHUTDOWN_FIREWALL,
BaseFunctionEnum.INSTALL_DOCKER,
BaseFunctionEnum.INSTALL_DOCKER_COMPOSE
// BaseFunctionEnum.MODIFY_DOCKER_CONFIG
);
projectDeployContext.setAgentNodeProcedure(agentNodeProcedure);
baseFuncScheduler.runProcedure(projectDeployContext);
// projectServerVO.getBindingServerList().forEach(
// serverInfoPO1 -> {
// if (!StringUtils.contains(serverInfoPO1.getServerName(), "01")) {
// projectDeployContext.setMasterNode(serverInfoPO1);
//
// baseFuncScheduler.runProcedure(projectDeployContext);
// }
// }
// );
// harborFuncScheduler.runProcedure(projectDeployContext);
appFuncScheduler.runProcedure(projectDeployContext);
// appFuncScheduler.runProcedure(projectDeployContext);
}
}