[Agent][Deploy] - cmii update accomplish

This commit is contained in:
zeaslity
2024-06-14 18:01:50 +08:00
parent f3db4a9ff6
commit 32a9c8f8ee
49 changed files with 9762 additions and 8982 deletions

View File

@@ -6,9 +6,10 @@ import (
"wdd.io/agent-common/logger"
"wdd.io/agent-common/utils"
"wdd.io/agent-deploy/a_dashboard"
"wdd.io/agent-deploy/a_nfs"
"wdd.io/agent-deploy/b_middle"
"wdd.io/agent-deploy/c_app"
"wdd.io/agent-deploy/b_nfs"
"wdd.io/agent-deploy/c_middle"
"wdd.io/agent-deploy/d_app"
"wdd.io/agent-deploy/e_cmii"
"wdd.io/agent-deploy/z_dep"
)
@@ -33,30 +34,30 @@ func OctopusDeploy() {
// kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
a_dashboard.K8sDashboardDeploy(common)
a_nfs.NFSDeploy(common)
a_nfs.NFSTestDeploy(common)
b_nfs.NFSDeploy(common)
b_nfs.NFSTestDeploy(common)
// pvc
b_middle.PVCDeploy(common)
c_middle.PVCDeploy(common)
// middlewares
b_middle.MidMySQlDeploy(common)
b_middle.MidRedisDeploy(common)
b_middle.MidEmqxDeploy(common)
b_middle.MidMongoDeploy(common)
b_middle.MidRabbitMQDeploy(common)
b_middle.MidRabbitMQDeploy(common)
b_middle.MidNacosDeploy(common)
c_middle.MidMySQlDeploy(common)
c_middle.MidRedisDeploy(common)
c_middle.MidEmqxDeploy(common)
c_middle.MidMongoDeploy(common)
c_middle.MidRabbitMQDeploy(common)
c_middle.MidRabbitMQDeploy(common)
c_middle.MidNacosDeploy(common)
configMapDeploy(common)
c_app.IngressDeploy(common)
d_app.IngressDeploy(common)
gzipFilePrefix := "/root/octopus_image/xjyd/"
frontendImageVersionMap, backendImageVersionMap, _ := image2.GzipFolderPathToCmiiImageTagMaps(gzipFilePrefix)
backendDeploy(common, backendImageVersionMap)
frontendDeploy(common, frontendImageVersionMap)
c_app.SRSDeploy(common)
d_app.SRSDeploy(common)
}
func CmiiAppDeploy() {
@@ -111,16 +112,16 @@ func backendDeploy(common *z_dep.CommonEnvironmentConfig, backendImageVersionMap
os.Remove(z_dep.BackendApplyFilePath)
for appName, tag := range backendImageVersionMap {
c_app.DefaultCmiiBackendConfig.AppName = appName
c_app.DefaultCmiiBackendConfig.ImageTag = tag
d_app.DefaultCmiiBackendConfig.AppName = appName
d_app.DefaultCmiiBackendConfig.ImageTag = tag
_, ok := IgnoreCmiiBackendAppName[appName]
if ok {
c_app.DefaultCmiiBackendConfig.Replicas = "0"
d_app.DefaultCmiiBackendConfig.Replicas = "0"
} else {
c_app.DefaultCmiiBackendConfig.Replicas = "1"
d_app.DefaultCmiiBackendConfig.Replicas = "1"
}
c_app.DefaultCmiiBackendConfig.BackendDeploy(common)
d_app.DefaultCmiiBackendConfig.BackendDeploy(common)
}
}
@@ -128,41 +129,41 @@ func frontendDeploy(common *z_dep.CommonEnvironmentConfig, frontendImageVersionM
os.Remove(z_dep.FrontendApplyFilePath)
c_app.FrontendDefaultNginxDeploy(common)
d_app.FrontendDefaultNginxDeploy(common)
for appName, tag := range frontendImageVersionMap {
c_app.DefaultCmiiFrontendConfig.AppName = appName
c_app.DefaultCmiiFrontendConfig.ImageTag = tag
c_app.DefaultCmiiFrontendConfig.Replicas = "1"
d_app.DefaultCmiiFrontendConfig.AppName = appName
d_app.DefaultCmiiFrontendConfig.ImageTag = tag
d_app.DefaultCmiiFrontendConfig.Replicas = "1"
value, ok := c_app.FrontendShortNameMaps[appName]
value, ok := d_app.FrontendShortNameMaps[appName]
if !ok {
log.ErrorF("FrontendShortNameMaps error ! not contains %s", appName)
continue
}
c_app.DefaultCmiiFrontendConfig.ShortName = value
d_app.DefaultCmiiFrontendConfig.ShortName = value
c_app.DefaultCmiiFrontendConfig.FrontendDeploy(common)
d_app.DefaultCmiiFrontendConfig.FrontendDeploy(common)
}
}
func configMapDeploy(common *z_dep.CommonEnvironmentConfig) {
os.Remove(z_dep.ConfigMapApplyFilePath)
for frontendName, shortName := range c_app.FrontendShortNameMaps {
c_app.DefaultCmiiFrontendConfig.AppName = frontendName
c_app.DefaultCmiiFrontendConfig.ShortName = shortName
for frontendName, shortName := range d_app.FrontendShortNameMaps {
d_app.DefaultCmiiFrontendConfig.AppName = frontendName
d_app.DefaultCmiiFrontendConfig.ShortName = shortName
value, ok := c_app.FrontendClientIdMaps[frontendName]
value, ok := d_app.FrontendClientIdMaps[frontendName]
if !ok {
log.ErrorF("FrontendClientIdMaps error ! not contains %s", frontendName)
continue
}
c_app.DefaultCmiiFrontendConfig.ClientId = value
d_app.DefaultCmiiFrontendConfig.ClientId = value
c_app.DefaultCmiiFrontendConfig.ConfigMapDeploy(common)
d_app.DefaultCmiiFrontendConfig.ConfigMapDeploy(common)
}
}
@@ -190,18 +191,19 @@ func CmiiEnvironmentDeploy(isCompleteDeploy bool, commonEnv *z_dep.CommonEnviron
if isCompleteDeploy {
// pvc
b_middle.PVCDeploy(commonEnv)
c_middle.PVCDeploy(commonEnv)
// middlewares
b_middle.MidMySQlDeploy(commonEnv)
b_middle.MidRedisDeploy(commonEnv)
b_middle.MidEmqxDeploy(commonEnv)
b_middle.MidMongoDeploy(commonEnv)
b_middle.MidRabbitMQDeploy(commonEnv)
b_middle.MidNacosDeploy(commonEnv)
e_cmii.CmiiDevConfig.MySQlConfig.MidMySQlDeploy(commonEnv)
e_cmii.CmiiDevConfig.RedisConfig.MidRedisDeploy(commonEnv)
e_cmii.CmiiDevConfig.EmqxConfig.MidEmqxDeploy(commonEnv)
e_cmii.CmiiDevConfig.MongoConfig.MidMongoDeploy(commonEnv)
e_cmii.CmiiDevConfig.RabbitMQConfig.MidRabbitMQDeploy(commonEnv)
e_cmii.CmiiDevConfig.NacosConfig.MidNacosDeploy(commonEnv)
configMapDeploy(commonEnv)
c_app.IngressDeploy(commonEnv)
d_app.DefaultIngressConfig.IngressDeploy(commonEnv)
}