[agent-operator] - cmii deploy part - basic accomplished
This commit is contained in:
@@ -2,7 +2,6 @@ package agent_deploy
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
image2 "wdd.io/agent-common/image"
|
||||
"wdd.io/agent-common/logger"
|
||||
"wdd.io/agent-common/utils"
|
||||
@@ -168,72 +167,49 @@ func configMapDeploy(common *z_dep.CommonEnvironmentConfig) {
|
||||
}
|
||||
|
||||
// CmiiEnvironmentDeploy 部署完整的CMII环境的所有组件
|
||||
func CmiiEnvironmentDeploy(isCompleteDeploy bool, cmiiNameSpace string, backendImageVersionMap, frontendImageVersionMap map[string]string) (applyYamlFolder string) {
|
||||
|
||||
folderPrefix := "/home/wdd/IdeaProjects/ProjectOctopus/agent-deploy/" + cmiiNameSpace + "/"
|
||||
|
||||
tenantEnv := cmiiNameSpace
|
||||
if strings.Contains(cmiiNameSpace, "-") {
|
||||
split := strings.Split(cmiiNameSpace, "-")
|
||||
tenantEnv = split[len(split)-1]
|
||||
}
|
||||
|
||||
// common environment
|
||||
common := &z_dep.CommonEnvironmentConfig{
|
||||
WebIP: "lab.uavcmlc.com",
|
||||
WebPort: "",
|
||||
HarborIP: image2.CmiiHarborPrefix,
|
||||
HarborPort: "",
|
||||
Namespace: cmiiNameSpace,
|
||||
TagVersion: "5.5.0",
|
||||
TenantEnv: tenantEnv,
|
||||
ApplyFilePrefix: folderPrefix,
|
||||
}
|
||||
func CmiiEnvironmentDeploy(isCompleteDeploy bool, commonEnv *z_dep.CommonEnvironmentConfig, backendImageVersionMap, frontendImageVersionMap map[string]string) {
|
||||
|
||||
// clear old apply file
|
||||
_ = os.Mkdir(folderPrefix, os.ModePerm)
|
||||
_ = os.Mkdir(commonEnv.ApplyFilePrefix, os.ModePerm)
|
||||
|
||||
oldApplyFileFolder := folderPrefix + "old"
|
||||
oldApplyFileFolder := commonEnv.ApplyFilePrefix + "old"
|
||||
utils.RemoveFolderComplete(oldApplyFileFolder)
|
||||
_ = os.Mkdir(oldApplyFileFolder, os.ModePerm)
|
||||
|
||||
// move all apply file to old folder
|
||||
_ = utils.FolderMoveFiles(folderPrefix, oldApplyFileFolder)
|
||||
_ = utils.FolderMoveFiles(commonEnv.ApplyFilePrefix, oldApplyFileFolder)
|
||||
|
||||
// clear all middleware data
|
||||
// ignore redis rabbitmq mongo nacos emqx
|
||||
// sync mysql-data
|
||||
|
||||
// generate
|
||||
common.GenerateApplyFilePath()
|
||||
commonEnv.GenerateApplyFilePath()
|
||||
|
||||
// generate new apply file for specific environment
|
||||
if isCompleteDeploy {
|
||||
|
||||
// pvc
|
||||
b_middle.PVCDeploy(common)
|
||||
b_middle.PVCDeploy(commonEnv)
|
||||
|
||||
// middlewares
|
||||
b_middle.MidMySQlDeploy(common)
|
||||
b_middle.MidRedisDeploy(common)
|
||||
b_middle.MidEmqxDeploy(common)
|
||||
b_middle.MidMongoDeploy(common)
|
||||
b_middle.MidRabbitMQDeploy(common)
|
||||
b_middle.MidNacosDeploy(common)
|
||||
b_middle.MidMySQlDeploy(commonEnv)
|
||||
b_middle.MidRedisDeploy(commonEnv)
|
||||
b_middle.MidEmqxDeploy(commonEnv)
|
||||
b_middle.MidMongoDeploy(commonEnv)
|
||||
b_middle.MidRabbitMQDeploy(commonEnv)
|
||||
b_middle.MidNacosDeploy(commonEnv)
|
||||
|
||||
configMapDeploy(common)
|
||||
c_app.IngressDeploy(common)
|
||||
configMapDeploy(commonEnv)
|
||||
c_app.IngressDeploy(commonEnv)
|
||||
|
||||
}
|
||||
|
||||
// frontend
|
||||
|
||||
// frontend
|
||||
frontendDeploy(common, frontendImageVersionMap)
|
||||
frontendDeploy(commonEnv, frontendImageVersionMap)
|
||||
// backend
|
||||
backendDeploy(common, backendImageVersionMap)
|
||||
backendDeploy(commonEnv, backendImageVersionMap)
|
||||
|
||||
// apply for them
|
||||
|
||||
return folderPrefix
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user