[ Agent ] [ App ] - fix middlewares bugs

This commit is contained in:
zeaslity
2023-11-22 11:25:33 +08:00
parent a2d57bcab8
commit be97b71b75
3 changed files with 30 additions and 6 deletions

View File

@@ -399,6 +399,10 @@ func (op *AgentOsOperator) deployPVC(funcArgs []string) (bool, []string) {
result = append(result, "替换SUPREME信息")
return false, result
}
// 替换版本号
if !BasicReplace(k8sPvcYamlFile, "KIMMY", funcArgs[6]) {
log.WarnF("[deployPVC] - pvc config version replace error , expected => %s", funcArgs[6])
}
// 启动服务
exec, strings := KubectlApplyExec(k8sPvcYamlFile)
@@ -528,16 +532,36 @@ func (op *AgentOsOperator) deployMiddlewares(funcArgs []string) (bool, []string)
return false, result
}
// 替换版本号
if !BasicReplace(k8sMiddlewaresYamlFile, "KIMMY", funcArgs[6]) {
log.WarnF("[deployPVC] - pvc config version replace error , expected => %s", funcArgs[6])
}
// 启动服务
exec, strings := KubectlApplyExec(k8sMiddlewaresYamlFile)
if !exec {
return false, append(result, strings...)
}
// 成功启动
return true, []string{
"中间件部署成功!",
// check status
podNameList := []string{
"helm-rabbitmq",
"helm-mongo",
"helm-emqxs",
"helm-nacos",
}
for _, podName := range podNameList {
if !K8sCheckPodStatusTimeout(podName, funcArgs[1], 180) {
return false, []string{
fmt.Sprintf("Namepsace [%s] Pod [%s] 启动失败!", funcArgs[1], podName),
}
}
}
// 成功启动
return true, append(podNameList,
"中间件部署成功!",
)
}

View File

@@ -144,7 +144,7 @@ func K8sCheckPVCStatusTimeOut(specificPvcName string, supreme string, waitTimeOu
log.ErrorF("[K8sCheckPVCStatusTimeOut] - 命名空间: [ %s ], 获取 PVC [%s] 信息失败: %s ", supreme, specificPvcName, err.Error())
}
if pvc.Status.Phase == "Running" {
if pvc.Status.Phase == corev1.ClaimBound {
log.DebugF("K8sCheckPVCStatusTimeOut] - PVC %s in namespace %s is running", specificPvcName, supreme)
return true
} else {