[ Agent ] [ APP ] - k8s dashboard
This commit is contained in:
@@ -133,7 +133,11 @@ func (op *AgentOsOperator) deployRke(funcArgs []string) (bool, []string) {
|
||||
},
|
||||
})
|
||||
|
||||
//
|
||||
if !BasicCreateFolder("/root/.kube") {
|
||||
return false, []string{
|
||||
"[deployRke] - folder [/root/.kube] create error!",
|
||||
}
|
||||
}
|
||||
|
||||
// replace ip addr
|
||||
parseIP := net.ParseIP(funcArgs[0])
|
||||
|
||||
@@ -1826,5 +1826,6 @@ func (op *AgentOsOperator) ok(funcArgs []string) [][]string {
|
||||
}
|
||||
|
||||
func (op *AgentOsOperator) okExec(funcArgs []string) (bool, []string) {
|
||||
log.WarnF("call empty base func ! func args are => %#v", funcArgs)
|
||||
return true, nil
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ func CheckDeploymentStatusTimeout(specificDeployment string, supreme string, wai
|
||||
func KubectlApplyExec(resourcesYamlFile string) (bool, []string) {
|
||||
|
||||
// check kubectl
|
||||
if !BasicCommandExists("kubectl") {
|
||||
if !BasicCommandExistByPath("kubectl") {
|
||||
return false, []string{
|
||||
"[KubectlApplyExec] - kubectl command not exist !",
|
||||
}
|
||||
@@ -136,7 +136,7 @@ func KubectlApplyExec(resourcesYamlFile string) (bool, []string) {
|
||||
|
||||
// apply -f
|
||||
ok, resultLog := AllCommandExecutor([]string{
|
||||
"kubectl",
|
||||
"/usr/local/bin/kubectl",
|
||||
"apply",
|
||||
"-f",
|
||||
resourcesYamlFile,
|
||||
@@ -152,7 +152,7 @@ func KubectlApplyExec(resourcesYamlFile string) (bool, []string) {
|
||||
func KubectlDeleteExec(resourcesYamlFile string) (bool, []string) {
|
||||
|
||||
// check kubectl
|
||||
if !BasicCommandExists("kubectl") {
|
||||
if !BasicCommandExistByPath("kubectl") {
|
||||
return false, []string{
|
||||
"[KubectlDeleteExec] - kubectl command not exist !",
|
||||
}
|
||||
@@ -167,7 +167,7 @@ func KubectlDeleteExec(resourcesYamlFile string) (bool, []string) {
|
||||
|
||||
// apply -f
|
||||
ok, resultLog := AllCommandExecutor([]string{
|
||||
"kubectl",
|
||||
"/usr/local/bin/kubectl",
|
||||
"delete",
|
||||
"-f",
|
||||
resourcesYamlFile,
|
||||
|
||||
@@ -94,8 +94,8 @@ public class AppFuncScheduler {
|
||||
);
|
||||
|
||||
List<AppFunctionEnum> appFunctionEnumList = List.of(
|
||||
AppFunctionEnum.DEPLOY_RKE
|
||||
// AppFunctionEnum.DEPLOY_K8S_DASHBOARD
|
||||
// AppFunctionEnum.DEPLOY_RKE
|
||||
AppFunctionEnum.DEPLOY_K8S_DASHBOARD
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -43,12 +44,8 @@ public class BaseFuncScheduler {
|
||||
|
||||
private void doRunProcedure(ProjectDeployContext projectDeployContext) {
|
||||
|
||||
// 执行 基础功能施工的内容
|
||||
String masterTopicName = projectDeployContext
|
||||
.getMasterNode()
|
||||
.getTopicName();
|
||||
|
||||
if (!MasterNodeBaseProcedure(masterTopicName)) {
|
||||
if (!MasterNodeBaseProcedure(projectDeployContext)) {
|
||||
log.error("Master 初始化过程错误! 即将终止!");
|
||||
}
|
||||
|
||||
@@ -83,7 +80,19 @@ public class BaseFuncScheduler {
|
||||
|
||||
}
|
||||
|
||||
private boolean MasterNodeBaseProcedure(String masterTopicName) {
|
||||
private boolean MasterNodeBaseProcedure(ProjectDeployContext projectDeployContext) {
|
||||
|
||||
// 执行 基础功能施工的内容
|
||||
String masterTopicName = projectDeployContext
|
||||
.getMasterNode()
|
||||
.getTopicName();
|
||||
|
||||
// base func args
|
||||
ArrayList<String> baseFuncArgList = new ArrayList<>();
|
||||
baseFuncArgList.add(projectDeployContext
|
||||
.getMasterNode()
|
||||
.getServerIpInV4());
|
||||
|
||||
|
||||
List<BaseFunctionEnum> masterNodeProcedureList = List.of(
|
||||
// BaseFunctionEnum.DISABLE_SWAP,
|
||||
@@ -98,10 +107,17 @@ public class BaseFuncScheduler {
|
||||
|
||||
|
||||
for (BaseFunctionEnum procedure : masterNodeProcedureList) {
|
||||
|
||||
// add op name
|
||||
baseFuncArgList.add(
|
||||
0,
|
||||
procedure.getFuncName()
|
||||
);
|
||||
|
||||
if (!funcService.callBaseFuncAndJudge(
|
||||
masterTopicName,
|
||||
procedure,
|
||||
null,
|
||||
baseFuncArgList,
|
||||
false
|
||||
)) {
|
||||
|
||||
@@ -115,17 +131,24 @@ public class BaseFuncScheduler {
|
||||
}
|
||||
|
||||
List<BaseFunctionEnum> masterNodeDurationTaskList = List.of(
|
||||
BaseFunctionEnum.INSTALL_DEFAULT_SSH_KEY
|
||||
BaseFunctionEnum.MODIFY_DOCKER_CONFIG
|
||||
// BaseFunctionEnum.INSTALL_DOCKER,
|
||||
// BaseFunctionEnum.INSTALL_DOCKER_COMPOSE,
|
||||
// BaseFunctionEnum.INSTALL_HARBOR
|
||||
);
|
||||
|
||||
for (BaseFunctionEnum durationBaseFunc : masterNodeDurationTaskList) {
|
||||
|
||||
// add op name
|
||||
baseFuncArgList.add(
|
||||
0,
|
||||
durationBaseFunc.getFuncName()
|
||||
);
|
||||
|
||||
if (!funcService.callBaseFuncAndJudge(
|
||||
masterTopicName,
|
||||
durationBaseFunc,
|
||||
null,
|
||||
baseFuncArgList,
|
||||
true
|
||||
)) {
|
||||
log.error(
|
||||
|
||||
@@ -50,14 +50,6 @@ public class FuncServiceImpl implements FuncService {
|
||||
"调用基本脚本 => {}",
|
||||
baseFunctionEnum.getDesc()
|
||||
);
|
||||
// 重新构造内容,增加Function Name
|
||||
if (CollectionUtils.isEmpty(funcArgs)) {
|
||||
funcArgs = new ArrayList<>();
|
||||
}
|
||||
funcArgs.add(
|
||||
0,
|
||||
baseFunctionEnum.getFuncName()
|
||||
);
|
||||
|
||||
List<String> syncResultLog = syncCallFunction(
|
||||
agentTopicName,
|
||||
|
||||
@@ -53,11 +53,11 @@ public class TestBaseFuncScheduler {
|
||||
projectDeployContext.setMasterNode(serverInfoPO);
|
||||
|
||||
|
||||
baseFuncScheduler.runProcedure(projectDeployContext);
|
||||
// baseFuncScheduler.runProcedure(projectDeployContext);
|
||||
|
||||
// harborFuncScheduler.runProcedure(projectDeployContext);
|
||||
|
||||
// appFuncScheduler.runProcedure(projectDeployContext);
|
||||
appFuncScheduler.runProcedure(projectDeployContext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user