[ Agent ] [ App ] - fix some bugs

This commit is contained in:
zeaslity
2023-12-04 16:46:50 +08:00
parent 22ac34ae4e
commit 004c0ba184
6 changed files with 28 additions and 27 deletions

View File

@@ -158,7 +158,7 @@ func (op *AgentOsOperator) deployRke(funcArgs []string) (bool, []string) {
"[deployRke] - ip args error !", "[deployRke] - ip args error !",
} }
} }
if !BasicReplace("/root/wdd/rke-cluster.yml", "A1C2IP", funcArgs[1]) { if !BasicReplace("/root/wdd/rke-cluster.yml", "A1C2IP", funcArgs[0]) {
log.ErrorF("[deployRke] - rke config replace error !") log.ErrorF("[deployRke] - rke config replace error !")
} }

View File

@@ -241,15 +241,15 @@ func KubectlDeleteExec(resourcesYamlFile string) (bool, []string) {
func K8sCreateNamespace(namespaceName string) bool { func K8sCreateNamespace(namespaceName string) bool {
if k8sClient == nil { if k8sClient == nil {
log.ErrorF("k8s client is nil, run k8s function error !") // this should be the first call of k8s function
return false k8sClient = newK8sClientInstance()
if k8sClient == nil {
log.ErrorF("k8s client is nil, run k8s function error !")
return false
}
} }
namespace, err := k8sClient.CoreV1().Namespaces().Get(context.TODO(), namespaceName, metav1.GetOptions{}) namespace, _ := k8sClient.CoreV1().Namespaces().Get(context.TODO(), namespaceName, metav1.GetOptions{})
if err != nil {
log.ErrorF("Error getting namespace: %s ", err.Error())
return false
}
if namespace != nil { if namespace != nil {
log.InfoF("[K8sCreateNamespace] - namespace of [%s] already exists!", namespaceName) log.InfoF("[K8sCreateNamespace] - namespace of [%s] already exists!", namespaceName)
return true return true
@@ -263,6 +263,7 @@ func K8sCreateNamespace(namespaceName string) bool {
}, },
} }
// 使用客户端创建命名空间 // 使用客户端创建命名空间
var err error
namespace, err = k8sClient.CoreV1().Namespaces().Create(context.TODO(), namespace, metav1.CreateOptions{}) namespace, err = k8sClient.CoreV1().Namespaces().Create(context.TODO(), namespace, metav1.CreateOptions{})
if err != nil { if err != nil {
log.ErrorF("Error getting namespace: %s ", err.Error()) log.ErrorF("Error getting namespace: %s ", err.Error())

View File

@@ -78,7 +78,6 @@ func MysqlSqlFileLoad(jackeyLoveIp string, jackeyLoveFileList []string) (bool, [
executeError, executeError,
} }
} }
log.DebugF("[MysqlSqlFileLoad] - jackeyLoveFile %s execute success !", jackeyLove.Name()) log.DebugF("[MysqlSqlFileLoad] - jackeyLoveFile %s execute success !", jackeyLove.Name())
} }

View File

@@ -99,11 +99,11 @@ public class AppFuncScheduler {
List<AppFunctionEnum> appFunctionEnumList = List.of( List<AppFunctionEnum> appFunctionEnumList = List.of(
// AppFunctionEnum.DEPLOY_RKE // AppFunctionEnum.DEPLOY_RKE
// AppFunctionEnum.DEPLOY_TEST_NFS // AppFunctionEnum.DEPLOY_TEST_NFS
// AppFunctionEnum.DEPLOY_K8S_NAMESPACE, AppFunctionEnum.DEPLOY_K8S_NAMESPACE,
// AppFunctionEnum.DEPLOY_K8S_MYSQL AppFunctionEnum.DEPLOY_K8S_MYSQL
// AppFunctionEnum.DEPLOY_K8S_REDIS // AppFunctionEnum.DEPLOY_K8S_REDIS
// AppFunctionEnum.DEPLOY_K8S_PVC // AppFunctionEnum.DEPLOY_K8S_PVC
AppFunctionEnum.LOAD_MYSQL_INIT_SCRIPT // AppFunctionEnum.LOAD_MYSQL_INIT_SCRIPT
); );

View File

@@ -95,11 +95,12 @@ public class BaseFuncScheduler {
List<BaseFunctionEnum> masterNodeProcedureList = List.of( List<BaseFunctionEnum> masterNodeProcedureList = List.of(
// BaseFunctionEnum.DISABLE_SWAP, BaseFunctionEnum.DISABLE_SWAP,
// BaseFunctionEnum.SHUTDOWN_FIREWALL, BaseFunctionEnum.SHUTDOWN_FIREWALL,
// BaseFunctionEnum.INSTALL_CHRONY, BaseFunctionEnum.INSTALL_CHRONY,
// BaseFunctionEnum.CHRONY_TO_PUBLIC_NTP, BaseFunctionEnum.CHRONY_TO_PUBLIC_NTP,
// BaseFunctionEnum.INSTALL_DEFAULT_SSH_KEY, BaseFunctionEnum.INSTALL_DEFAULT_SSH_KEY,
BaseFunctionEnum.MODIFY_DOCKER_CONFIG
// BaseFunctionEnum.INSTALL_HARBOR, // BaseFunctionEnum.INSTALL_HARBOR,
// BaseFunctionEnum.INSTALL_ZSH // BaseFunctionEnum.INSTALL_ZSH
@@ -131,10 +132,10 @@ public class BaseFuncScheduler {
} }
List<BaseFunctionEnum> masterNodeDurationTaskList = List.of( List<BaseFunctionEnum> masterNodeDurationTaskList = List.of(
BaseFunctionEnum.INSTALL_NFS_SERVER_ONLINE BaseFunctionEnum.INSTALL_NFS_SERVER_ONLINE,
// BaseFunctionEnum.INSTALL_DOCKER, BaseFunctionEnum.INSTALL_DOCKER,
// BaseFunctionEnum.INSTALL_DOCKER_COMPOSE, BaseFunctionEnum.INSTALL_DOCKER_COMPOSE,
// BaseFunctionEnum.INSTALL_HARBOR BaseFunctionEnum.INSTALL_HARBOR
); );
for (BaseFunctionEnum durationBaseFunc : masterNodeDurationTaskList) { for (BaseFunctionEnum durationBaseFunc : masterNodeDurationTaskList) {

View File

@@ -55,15 +55,15 @@ public class HarborFuncScheduler {
.getTopicName(); .getTopicName();
// create harbor project // create harbor project
// if (!CreateHarborProject(projectDeployContext)) { if (!CreateHarborProject(projectDeployContext)) {
// log.error("create harbor project failed !"); log.error("create harbor project failed !");
// } }
// check harbor project // check harbor project
// list // list
// if (!ListHarborProject(projectDeployContext)) { if (!ListHarborProject(projectDeployContext)) {
// log.error("list harbor project failed !"); log.error("list harbor project failed !");
// } }
int maxSyncStatusCheckCount = 1000; int maxSyncStatusCheckCount = 1000;
int timePinch = 2; int timePinch = 2;