diff --git a/api/handler/service_plugin.go b/api/handler/service_plugin.go index 940ed5f70..99981e84f 100644 --- a/api/handler/service_plugin.go +++ b/api/handler/service_plugin.go @@ -154,14 +154,22 @@ func (s *ServiceAction) SetTenantServicePluginRelation(tenantID, serviceID strin tx.Rollback() return nil, util.CreateAPIHandleErrorFromDBError("set service plugin env error ", err) } + tsprCPU := pluginversion.ContainerCPU + tsprMemory := pluginversion.ContainerMemory + if pss.Body.PluginCPU != 0 { + tsprCPU = pss.Body.PluginCPU + } + if pss.Body.PluginMemory != 0 { + tsprMemory = pss.Body.PluginMemory + } relation := &dbmodel.TenantServicePluginRelation{ VersionID: pss.Body.VersionID, ServiceID: serviceID, PluginID: pss.Body.PluginID, Switch: pss.Body.Switch, PluginModel: plugin.PluginModel, - ContainerCPU: pluginversion.ContainerCPU, - ContainerMemory: pluginversion.ContainerMemory, + ContainerCPU: tsprCPU, + ContainerMemory: tsprMemory, } if err := db.GetManager().TenantServicePluginRelationDaoTransactions(tx).AddModel(relation); err != nil { tx.Rollback()