Merge branch 'master' into 961

This commit is contained in:
黄润豪 2021-05-14 18:43:32 +08:00 committed by GitHub
commit fdee03946b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 17 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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"`
}