[Agent][Deploy] - cmii deploy template rearrange
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user