[Agent][Deploy] - cmii update
This commit is contained in:
38
agent-operator/CmiiDeployOperator.go
Normal file → Executable file
38
agent-operator/CmiiDeployOperator.go
Normal file → Executable file
@@ -1,10 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"wdd.io/agent-common/utils"
|
||||
"wdd.io/agent-deploy"
|
||||
agent_deploy "wdd.io/agent-deploy"
|
||||
"wdd.io/agent-operator/image"
|
||||
)
|
||||
|
||||
@@ -36,13 +37,18 @@ func CmiiEnvDeploy() {
|
||||
utils.BeautifulPrintWithTitle(srsMap, "srsMap")
|
||||
|
||||
// generate and get all old stuff
|
||||
applyYamlFolder := agent_deploy.CmiiEnvironmentDeploy(shouldDoCompleteDeploy, cmiiNamespace, frontendMap, backendMap)
|
||||
applyYamlFolder := agent_deploy.CmiiEnvironmentDeploy(shouldDoCompleteDeploy, cmiiNamespace, backendMap, frontendMap)
|
||||
|
||||
fmt.Println(applyYamlFolder)
|
||||
|
||||
// test
|
||||
//GetNodeWideByKubectl(cmiiNamespace)
|
||||
|
||||
// clear old apply file
|
||||
clearOldApplyStuff(applyYamlFolder+"old/", cmiiNamespace)
|
||||
//clearOldApplyStuff(applyYamlFolder+"old/", cmiiNamespace)
|
||||
|
||||
// apply new app
|
||||
applyNewAppStuff(applyYamlFolder, cmiiNamespace)
|
||||
//applyNewAppStuff(applyYamlFolder, cmiiNamespace)
|
||||
|
||||
}
|
||||
|
||||
@@ -71,6 +77,9 @@ func clearOldApplyStuff(oldApplyYamlFolder string, cmiiEnv string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// rearrange
|
||||
rearrangeCmiiDeploySequence(files)
|
||||
|
||||
for _, file := range files {
|
||||
if filepath.Ext(file.Name()) == ".yaml" || filepath.Ext(file.Name()) == ".yml" {
|
||||
filePath := filepath.Join(oldApplyYamlFolder, file.Name())
|
||||
@@ -80,3 +89,24 @@ func clearOldApplyStuff(oldApplyYamlFolder string, cmiiEnv string) bool {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// rearrangeCmiiDeploySequence 重新排序CmiiDeploy顺序
|
||||
func rearrangeCmiiDeploySequence(files []os.DirEntry) {
|
||||
k8s - backend.yaml
|
||||
k8s - configmap.yaml
|
||||
k8s - emqx.yaml
|
||||
k8s - frontend.yaml
|
||||
k8s - ingress.yaml
|
||||
k8s - mongo.yaml
|
||||
k8s - mysql.yaml
|
||||
k8s - nacos.yaml
|
||||
k8s - pvc.yaml
|
||||
k8s - rabbitmq.yaml
|
||||
k8s - redis.yaml
|
||||
for _, file := range files {
|
||||
if filepath.Ext(file.Name()) == ".yaml" || filepath.Ext(file.Name()) == ".yml" {
|
||||
filePath := filepath.Join(oldApplyYamlFolder, file.Name())
|
||||
DeleteByKubectl(filePath, cmiiEnv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user