[ Cmii ] [ Octopus ] - project a lot

This commit is contained in:
zeaslity
2024-03-08 17:23:41 +08:00
parent 52c360eb49
commit 5e80d7baad
56 changed files with 1112 additions and 240 deletions

View File

@@ -6,6 +6,7 @@ import io.wdd.server.beans.po.ProjectInfoPO;
import io.wdd.server.coreService.CoreProjectService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -23,6 +24,43 @@ public class AppFuncScheduler {
@Resource
CoreProjectService coreProjectService;
/**
* 参数固定顺序为 A1C2IP SUPREME N1C2IP A1C1IP A1C1JS M2D2IP KIMMY JACLOVE
* 1 2 3 4 5 6 7 8
*
* @param projectDeployContext
* @param projectInfoPO
* @return
*/
private static ArrayList<String> buildAppFuncArgs(ProjectDeployContext projectDeployContext, ProjectInfoPO projectInfoPO) {
ArrayList<String> appFuncArgs = new ArrayList<>();
String masterIpInV4 = projectDeployContext
.getMasterNode()
.getServerIpInV4();
appFuncArgs.add(masterIpInV4);
appFuncArgs.add(projectInfoPO.getProjectNamespace());
appFuncArgs.add(masterIpInV4);
// A1C1IP
if (StringUtils.isBlank(projectDeployContext
.getMasterNode()
.getServerIpPbV4())) {
appFuncArgs.add(masterIpInV4);
} else {
appFuncArgs.add(projectDeployContext
.getMasterNode()
.getServerIpPbV4());
}
appFuncArgs.add(projectInfoPO.getProjectWebServicePort());
// M2D2IP
appFuncArgs.add(masterIpInV4);
appFuncArgs.add(projectInfoPO.getProjectVersion());
// jackeyLoveFile
appFuncArgs.add("init_5.1.0.tar");
return appFuncArgs;
}
public boolean runProcedure(ProjectDeployContext projectDeployContext) {
// before run
@@ -41,39 +79,6 @@ public class AppFuncScheduler {
return true;
}
/**
* 参数固定顺序为 A1C2IP SUPREME N1C2IP A1C1IP A1C1JS M2D2IP KIMMY JACLOVE
* 1 2 3 4 5 6 7 8
*
* @param projectDeployContext
* @param projectInfoPO
* @return
*/
private static ArrayList<String> buildAppFuncArgs(ProjectDeployContext projectDeployContext, ProjectInfoPO projectInfoPO) {
ArrayList<String> appFuncArgs = new ArrayList<>();
appFuncArgs.add(projectDeployContext
.getMasterNode()
.getServerIpInV4());
appFuncArgs.add(projectInfoPO.getProjectNamespace());
appFuncArgs.add(projectDeployContext
.getMasterNode()
.getServerIpInV4());
appFuncArgs.add(projectDeployContext
.getMasterNode()
.getServerIpPbV4());
appFuncArgs.add(projectInfoPO.getProjectWebServicePort());
// M2D2IP
appFuncArgs.add(projectDeployContext
.getMasterNode()
.getServerIpInV4());
appFuncArgs.add(projectInfoPO.getProjectVersion());
// jackeyLoveFile
appFuncArgs.add("init_5.1.0.tar");
return appFuncArgs;
}
private void beforeRunProcedure(ProjectDeployContext projectDeployContext) {
// 检查是否符合规定

View File

@@ -36,30 +36,36 @@ import static io.wdd.common.config.OctopusObjectMapperConfig.OctopusObjectMapper
@Slf4j(topic = "octopus agent init ")
public class AcceptAgentInitInfo {
public static final HashMap<String, Integer> ALL_SERVER_CITY_INDEX = new HashMap<>(
Map.of(
"Chengdu",
1,
"Shanghai",
2,
"HongKong",
3,
"Seoul",
4,
"Tokyo",
5,
"Phoenix",
6,
"London",
7,
"LosAngeles",
8,
"Beijing",
9,
"Chongqing",
10
)
);
public static final HashMap<String, Integer> ALL_SERVER_CITY_INDEX = new HashMap<>() {{
put("Chengdu",
1);
put("Shanghai",
2);
put("HongKong",
3);
put("Seoul",
4);
put("Tokyo",
5);
put("Phoenix",
6)
;
put("London",
7)
;
put("LosAngeles",
8);
put("Beijing",
9);
put("Chongqing",
10)
;
put("Ziyang",
11);
}};
public static Set<String> ALL_SERVER_ARCH_INFO = new HashSet<>(
Arrays.asList(
"amd64",

View File

@@ -46,13 +46,17 @@ public class TestBaseFuncScheduler {
// Long projectServerId = 1751084188582440961L;// cqga
// Long projectServerId = 1722453318596550657L;// lappro
Long projectServerId = 1752602668144975873L;// cqlyj
// Long projectServerId = 1752602668144975873L;// cqlyj
// Long projectServerId = 1764575895186030593L;// 上海雷视联动
// Long projectServerId = 1765290465066692610L;// 吉林移动
Long projectServerId = 1765654823726669826L;// 资阳公安
projectDeployContext.setProjectId(projectServerId);
String masterNodeServerName = "Chongqing-amd64-01"; // cgga
// String masterNodeServerName = "Chengdu-amd64-99"; // lap pro
// String masterNodeServerName = "Shanghai-amd64-09"; // cgga
// String masterNodeServerName = "Chengdu-amd64-51"; // lap pro
String masterNodeServerName = "Ziyang-amd64-61"; // 资阳公安
ProjectServerVO projectServerVO = coreProjectServerService.projectServerOne(projectServerId);
Map<Boolean, List<ServerInfoPO>> collect = projectServerVO.getBindingServerList().stream().collect(
@@ -63,7 +67,7 @@ public class TestBaseFuncScheduler {
if (collect.get(Boolean.TRUE) == null) {
System.out.printf("project of %s master server of %s is empty", projectServerVO, masterNodeServerName);
System.out.printf("project of %s master server of %s is empty\n", projectServerVO, masterNodeServerName);
return;
}
projectDeployContext.setMasterNode(collect.get(Boolean.TRUE).get(0));
@@ -73,22 +77,23 @@ public class TestBaseFuncScheduler {
List<BaseFunctionEnum> masterNodeProcedure = List.of(
// BaseFunctionEnum.DISABLE_SWAP,
// BaseFunctionEnum.DISABLE_SELINUX,
// BaseFunctionEnum.SHUTDOWN_FIREWALL,
// BaseFunctionEnum.INSTALL_DOCKER,
// BaseFunctionEnum.INSTALL_DEFAULT_SSH_KEY,
// BaseFunctionEnum.INSTALL_DOCKER_COMPOSE,
// BaseFunctionEnum.MODIFY_DOCKER_CONFIG,
// BaseFunctionEnum.MODIFY_DOCKER_CONFIG
// BaseFunctionEnum.INSTALL_HARBOR
BaseFunctionEnum.INSTALL_DEFAULT_SSH_KEY
);
List<BaseFunctionEnum> agentNodeProcedure = List.of(
// BaseFunctionEnum.DISABLE_SWAP,
// BaseFunctionEnum.SHUTDOWN_FIREWALL,
// BaseFunctionEnum.INSTALL_DOCKER,
// BaseFunctionEnum.INSTALL_DOCKER_COMPOSE
// BaseFunctionEnum.MODIFY_DOCKER_CONFIG
// BaseFunctionEnum.INSTALL_DEFAULT_SSH_KEY
BaseFunctionEnum.DISABLE_SWAP,
BaseFunctionEnum.INSTALL_DEFAULT_SSH_KEY,
BaseFunctionEnum.DISABLE_SELINUX,
BaseFunctionEnum.SHUTDOWN_FIREWALL,
BaseFunctionEnum.INSTALL_DOCKER,
BaseFunctionEnum.INSTALL_DOCKER_COMPOSE,
BaseFunctionEnum.MODIFY_DOCKER_CONFIG
);
projectDeployContext.setMasterNodeBaseProcedure(masterNodeProcedure);
@@ -115,18 +120,18 @@ public class TestBaseFuncScheduler {
List<AppFunctionEnum> appFunctionEnumList = List.of(
// AppFunctionEnum.DEPLOY_CHRONY_SERVER,
// AppFunctionEnum.DEPLOY_RKE
// AppFunctionEnum.DEPLOY_K8S_DASHBOARD
// AppFunctionEnum.DEPLOY_K8S_DASHBOARD,
// AppFunctionEnum.DEPLOY_NFS,
// AppFunctionEnum.DEPLOY_TEST_NFS,
// AppFunctionEnum.DEPLOY_TEST_NFS
// AppFunctionEnum.DEPLOY_K8S_NAMESPACE,
// AppFunctionEnum.DEPLOY_K8S_PVC,
// AppFunctionEnum.DEPLOY_K8S_MYSQL,
// AppFunctionEnum.DEPLOY_K8S_REDIS,
// AppFunctionEnum.DEPLOY_K8S_MIDDLEWARES
// AppFunctionEnum.DEPLOY_INGRESS
// AppFunctionEnum.DEPLOY_INGRESS,
// AppFunctionEnum.DEPLOY_FRONTEND
AppFunctionEnum.DEPLOY_BACKEND
// AppFunctionEnum.DEPLOY_K8S_SRS
// AppFunctionEnum.DEPLOY_BACKEND
AppFunctionEnum.DEPLOY_K8S_SRS
);
projectDeployContext.setMasterAppProcedure(appFunctionEnumList);
@@ -138,7 +143,7 @@ public class TestBaseFuncScheduler {
agentNodeProcedure = List.of(BaseFunctionEnum.CHRONY_TO_MASTER);
projectDeployContext.setMasterNodeBaseProcedure(masterNodeProcedure);
// projectDeployContext.setAgentNodeBaseProcedure(agentNodeProcedure);
projectDeployContext.setAgentNodeBaseProcedure(agentNodeProcedure);
// baseFuncScheduler.runProcedure(projectDeployContext);
}