[ Agent ] [ App ] - offline fix bugs
This commit is contained in:
@@ -158,7 +158,7 @@ func (op *AgentOsOperator) deployRke(funcArgs []string) (bool, []string) {
|
||||
"[deployRke] - ip args error !",
|
||||
}
|
||||
}
|
||||
if !BasicReplace("/root/wdd/rke-cluster.yml", "A1C2IP", funcArgs[0]) {
|
||||
if !BasicReplace("/root/wdd/cluster.yml", "A1C2IP", funcArgs[0]) {
|
||||
log.ErrorF("[deployRke] - rke config replace error !")
|
||||
}
|
||||
|
||||
@@ -347,6 +347,10 @@ func (op *AgentOsOperator) deployTestNFS(funcArgs []string) (bool, []string) {
|
||||
result = append(result, "命令不存在", "kubectl")
|
||||
return false, result
|
||||
}
|
||||
folder, i := CheckAppInstallFolder()
|
||||
if !folder {
|
||||
return false, i
|
||||
}
|
||||
|
||||
// 下载模板文件
|
||||
k8sNFSYamlFile := "/root/wdd/install/k8s-nfs-test.yaml"
|
||||
@@ -373,8 +377,9 @@ func (op *AgentOsOperator) deployTestNFS(funcArgs []string) (bool, []string) {
|
||||
}
|
||||
|
||||
// 测试文件是否存在
|
||||
if !BasicFileExists(nfsDataPath + "/default-test-claim-pvc*/NFS-CREATE-SUCCESS") {
|
||||
result = append(result, "NFS 文件写入 异常!!")
|
||||
commandExecutor, _ := HardCodeCommandExecutor("test -f " + nfsDataPath + "/default-test-claim-pvc*/NFS-CREATE-SUCCESS")
|
||||
if !commandExecutor {
|
||||
log.WarnF("[deployTestNFS] - test nfs file write error !")
|
||||
}
|
||||
|
||||
if !K8sCheckPodStatusTimeout("test-pod", "default", 30) {
|
||||
@@ -399,6 +404,10 @@ func (op *AgentOsOperator) deployPVC(funcArgs []string) (bool, []string) {
|
||||
result = append(result, "命令不存在", "kubectl")
|
||||
return false, result
|
||||
}
|
||||
folder, i := CheckAppInstallFolder()
|
||||
if !folder {
|
||||
return false, i
|
||||
}
|
||||
|
||||
// 下载模板文件
|
||||
k8sPvcYamlFile := "/root/wdd/install/k8s-pvc.yaml"
|
||||
|
||||
@@ -1825,7 +1825,7 @@ func (op *AgentOsOperator) installChronyByDockerExec(funcArgs []string) (bool, [
|
||||
"--publish=123:123/udp",
|
||||
"--env=NTP_SERVERS=\"ntp1.aliyun.com,ntp2.aliyun.com,ntp3.aliyun.com,ntp4.aliyun.com\"",
|
||||
"--env=LOG_LEVEL=0",
|
||||
funcArgs[0] + ":8033/cmii/chronyd:0.4.3",
|
||||
funcArgs[0] + ":8033/cmii/chronyd:0.4.3",
|
||||
})
|
||||
if !ok {
|
||||
return false, append(resultLog, "[installChronyByDockerExec] - docker chrony run error !")
|
||||
|
||||
@@ -47,6 +47,15 @@ func newK8sClientInstance() *kubernetes.Clientset {
|
||||
|
||||
func K8sCheckPodStatusTimeout(specificPod string, supreme string, waitTimeOut int) bool {
|
||||
|
||||
if k8sClient == nil {
|
||||
// this should be the first call of k8s function
|
||||
k8sClient = newK8sClientInstance()
|
||||
if k8sClient == nil {
|
||||
log.ErrorF("k8s client is nil, run k8s function error !")
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 设置超时时间和时间间隔
|
||||
timeout := time.After(time.Duration(waitTimeOut) * time.Second)
|
||||
tick := time.Tick(5 * time.Second)
|
||||
@@ -73,6 +82,15 @@ func K8sCheckPodStatusTimeout(specificPod string, supreme string, waitTimeOut in
|
||||
|
||||
func K8sCheckDeploymentStatusTimeout(specificDeployment string, supreme string, waitTimeOut int) bool {
|
||||
|
||||
if k8sClient == nil {
|
||||
// this should be the first call of k8s function
|
||||
k8sClient = newK8sClientInstance()
|
||||
if k8sClient == nil {
|
||||
log.ErrorF("k8s client is nil, run k8s function error !")
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 设置超时时间和时间间隔
|
||||
timeout := time.After(time.Duration(waitTimeOut) * time.Second)
|
||||
tick := time.Tick(5 * time.Second)
|
||||
@@ -101,9 +119,15 @@ func K8sCheckDeploymentStatusTimeout(specificDeployment string, supreme string,
|
||||
|
||||
func K8sListPVCInNamespace(supreme string) (bool, []string) {
|
||||
|
||||
if k8sClient == nil {
|
||||
// this should be the first call of k8s function
|
||||
k8sClient = newK8sClientInstance()
|
||||
if k8sClient == nil {
|
||||
log.ErrorF("k8s client is nil, run k8s function error !")
|
||||
return false, nil
|
||||
return false, []string{
|
||||
"[K8sListPVCInNamespace] - k8s client not exits !",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pvcs, err := k8sClient.CoreV1().PersistentVolumeClaims(supreme).List(context.TODO(), metav1.ListOptions{})
|
||||
@@ -123,10 +147,14 @@ func K8sListPVCInNamespace(supreme string) (bool, []string) {
|
||||
|
||||
func K8sCheckPVCStatusTimeOut(specificPvcName string, supreme string, waitTimeOut int) bool {
|
||||
|
||||
if k8sClient == nil {
|
||||
// this should be the first call of k8s function
|
||||
k8sClient = newK8sClientInstance()
|
||||
if k8sClient == nil {
|
||||
log.ErrorF("k8s client is nil, run k8s function error !")
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 设置超时时间和时间间隔
|
||||
timeout := time.After(time.Duration(waitTimeOut) * time.Second)
|
||||
@@ -287,7 +315,16 @@ func K8sCreateNamespace(namespaceName string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func K8sGetDashBoardAuthKey() {
|
||||
func K8sGetDashBoardAuthKey() bool {
|
||||
|
||||
if k8sClient == nil {
|
||||
// this should be the first call of k8s function
|
||||
k8sClient = newK8sClientInstance()
|
||||
if k8sClient == nil {
|
||||
log.ErrorF("k8s client is nil, run k8s function error !")
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 获取 kube-system 命名空间的 secrets 列表
|
||||
secrets, err := k8sClient.CoreV1().Secrets("kube-system").List(context.TODO(), metav1.ListOptions{})
|
||||
@@ -323,4 +360,6 @@ func K8sGetDashBoardAuthKey() {
|
||||
fmt.Printf("%s: %s\n", key, value)
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
@@ -100,14 +100,16 @@ public class AppFuncScheduler {
|
||||
);
|
||||
|
||||
List<AppFunctionEnum> appFunctionEnumList = List.of(
|
||||
AppFunctionEnum.DEPLOY_CHRONY_SERVER
|
||||
// AppFunctionEnum.DEPLOY_CHRONY_SERVER,
|
||||
// AppFunctionEnum.DEPLOY_RKE
|
||||
// AppFunctionEnum.DEPLOY_TEST_NFS
|
||||
// AppFunctionEnum.DEPLOY_K8S_NAMESPACE,
|
||||
// AppFunctionEnum.DEPLOY_K8S_MYSQL
|
||||
// AppFunctionEnum.DEPLOY_K8S_REDIS
|
||||
// AppFunctionEnum.DEPLOY_K8S_PVC
|
||||
// AppFunctionEnum.DEPLOY_INGRESS,
|
||||
AppFunctionEnum.DEPLOY_K8S_DASHBOARD,
|
||||
AppFunctionEnum.DEPLOY_NFS,
|
||||
AppFunctionEnum.DEPLOY_TEST_NFS,
|
||||
AppFunctionEnum.DEPLOY_K8S_NAMESPACE,
|
||||
AppFunctionEnum.DEPLOY_K8S_MYSQL,
|
||||
AppFunctionEnum.DEPLOY_K8S_REDIS,
|
||||
AppFunctionEnum.DEPLOY_K8S_PVC,
|
||||
AppFunctionEnum.DEPLOY_INGRESS
|
||||
// AppFunctionEnum.DEPLOY_FRONTEND
|
||||
// AppFunctionEnum.DEPLOY_BACKEND
|
||||
// AppFunctionEnum.DEPLOY_K8S_SRS
|
||||
|
||||
Reference in New Issue
Block a user