[Agent][Deploy] - cmii deploy template rearrange

This commit is contained in:
zeaslity
2024-06-18 09:52:28 +08:00
parent 51fbb2027d
commit 6b2dc33a34
46 changed files with 12655 additions and 13960 deletions

View File

@@ -12,8 +12,10 @@ var (
DefaultCmiiBackendConfig = &CmiiBackendConfig{}
DefaultCmiiFrontendConfig = &CmiiFrontendConfig{}
DefaultIngressConfig = &IngressConfig{
FrontendShortNameMaps: FrontendShortNameMaps,
FrontendShortNameMaps: FrontendShortNameMaps,
BackendImageVersionMap: CmiiBackendAppMap,
}
log = logger.Log
)
@@ -38,7 +40,8 @@ type CmiiFrontendConfig struct {
type IngressConfig struct {
z_dep.CommonEnvironmentConfig
FrontendShortNameMaps map[string]string
FrontendShortNameMaps map[string]string
BackendImageVersionMap map[string]string `json:"backend_image_version_map,omitempty" validate:"required"`
}
func (backend *CmiiBackendConfig) BackendDeploy(common *z_dep.CommonEnvironmentConfig) bool {
@@ -111,8 +114,13 @@ func (ingress *IngressConfig) IngressDeploy(commonEnv *z_dep.CommonEnvironmentCo
utils.CopySameFields(commonEnv, ingress)
// manual validate
if len(ingress.FrontendShortNameMaps) == 0 {
log.ErrorF("frontend short name is empty !")
if ingress.FrontendShortNameMaps == nil || len(ingress.FrontendShortNameMaps) == 0 {
log.Error("frontend short name is empty !")
return false
}
if ingress.BackendImageVersionMap == nil || len(ingress.BackendImageVersionMap) == 0 {
log.Error("backend image version map is empty !")
return false
}
@@ -120,11 +128,11 @@ func (ingress *IngressConfig) IngressDeploy(commonEnv *z_dep.CommonEnvironmentCo
return false
}
if !commonEnv.ParseCommonEnvToApplyFile(CmiiBackendIngressTemplate, z_dep.IngresApplyFilePath) {
if !z_dep.ParseEnvToApplyFile(ingress, CmiiBackendIngressTemplate, z_dep.IngresApplyFilePath) {
return false
}
if !commonEnv.ParseCommonEnvToApplyFile(CmiiGatewayIngressTemplate, z_dep.IngresApplyFilePath) {
if !z_dep.ParseEnvToApplyFile(ingress, CmiiGatewayIngressTemplate, z_dep.IngresApplyFilePath) {
return false
}