diff --git a/api/handler/application_config_group.go b/api/handler/application_config_group.go index 899530a17..4682ccfb2 100644 --- a/api/handler/application_config_group.go +++ b/api/handler/application_config_group.go @@ -136,6 +136,10 @@ func (a *ApplicationAction) UpdateConfigGroup(appID, configGroupName string, req ServiceAlias: s.ServiceAlias, } if err := db.GetManager().AppConfigGroupServiceDaoTransactions(tx).AddModel(&serviceConfigGroup); err != nil { + if err == bcode.ErrConfigGroupServiceExist { + logrus.Debugf("config group \"%s\" under this service \"%s\" already exists.", serviceConfigGroup.ConfigGroupName, serviceConfigGroup.ServiceID) + continue + } tx.Rollback() return nil, err } @@ -154,6 +158,10 @@ func (a *ApplicationAction) UpdateConfigGroup(appID, configGroupName string, req ItemValue: it.ItemValue, } if err := db.GetManager().AppConfigGroupItemDaoTransactions(tx).AddModel(configItem); err != nil { + if err == bcode.ErrConfigItemExist { + logrus.Debugf("config item \"%s\" under this config group \"%s\" already exists.", configItem.ItemKey, configItem.ConfigGroupName) + continue + } tx.Rollback() return nil, err } diff --git a/api/handler/service.go b/api/handler/service.go index 0e29ecaa9..9b03f2afc 100644 --- a/api/handler/service.go +++ b/api/handler/service.go @@ -1931,25 +1931,9 @@ func (s *ServiceAction) GetMultiServicePods(serviceIDs []string) (*K8sPodInfos, podInfo.PodIP = v.PodIp podInfo.PodStatus = v.PodStatus podInfo.ServiceID = serviceID - containerInfos := make(map[string]map[string]string, 10) - for _, container := range v.Containers { - containerInfos[container.ContainerName] = map[string]string{ - "memory_limit": fmt.Sprintf("%d", container.MemoryLimit), - "memory_usage": "0", - } - } - podInfo.Container = containerInfos podNames = append(podNames, v.PodName) podsInfoList = append(podsInfoList, &podInfo) } - containerMemInfo, _ := s.GetPodContainerMemory(podNames) - for _, c := range podsInfoList { - for k := range c.Container { - if info, exist := containerMemInfo[c.PodName][k]; exist { - c.Container[k]["memory_usage"] = info - } - } - } return podsInfoList } var re K8sPodInfos diff --git a/api/model/model.go b/api/model/model.go index a46e5086b..c90120c22 100644 --- a/api/model/model.go +++ b/api/model/model.go @@ -1250,7 +1250,7 @@ type AddTenantServiceEnvVar struct { ContainerPort int `validate:"container_port|numeric_between:1,65535" json:"container_port"` Name string `validate:"name" json:"name"` AttrName string `validate:"env_name|required" json:"env_name"` - AttrValue string `validate:"env_value|required" json:"env_value"` + AttrValue string `validate:"env_value" json:"env_value"` IsChange bool `validate:"is_change|bool" json:"is_change"` Scope string `validate:"scope|in:outer,inner,both,build" json:"scope"` }