diff --git a/db/model/tenant.go b/db/model/tenant.go index f847794b6..a649f56ed 100644 --- a/db/model/tenant.go +++ b/db/model/tenant.go @@ -27,7 +27,7 @@ import ( //Model 默认字段 type Model struct { - ID uint `gorm:"column:ID;primary_key" json:"id"` + ID uint `gorm:"column:ID;primary_key"` CreatedAt time.Time `gorm:"column:create_time" json:"create_time"` } diff --git a/worker/util/log_optoins.go b/event/log_optoins.go similarity index 97% rename from worker/util/log_optoins.go rename to event/log_optoins.go index 270ef010c..71ff1fa6c 100644 --- a/worker/util/log_optoins.go +++ b/event/log_optoins.go @@ -1,4 +1,4 @@ -package util +package event // GetLoggerOption - func GetLoggerOption(status string) map[string]string { diff --git a/worker/appm/controller/restart.go b/worker/appm/controller/restart.go index 749441dba..104eb0c1d 100644 --- a/worker/appm/controller/restart.go +++ b/worker/appm/controller/restart.go @@ -25,9 +25,9 @@ import ( "github.com/Sirupsen/logrus" "github.com/goodrain/rainbond/db" + "github.com/goodrain/rainbond/event" "github.com/goodrain/rainbond/worker/appm/conversion" v1 "github.com/goodrain/rainbond/worker/appm/types/v1" - "github.com/goodrain/rainbond/worker/util" ) type restartController struct { @@ -43,11 +43,11 @@ func (s *restartController) Begin() { go func(service v1.AppService) { wait.Add(1) defer wait.Done() - service.Logger.Info("App runtime begin restart app service "+service.ServiceAlias, util.GetLoggerOption("starting")) + service.Logger.Info("App runtime begin restart app service "+service.ServiceAlias, event.GetLoggerOption("starting")) if err := s.restartOne(service); err != nil { logrus.Errorf("restart service %s failure %s", service.ServiceAlias, err.Error()) } else { - service.Logger.Info(fmt.Sprintf("restart service %s success", service.ServiceAlias), util.GetLastLoggerOption()) + service.Logger.Info(fmt.Sprintf("restart service %s success", service.ServiceAlias), event.GetLastLoggerOption()) } }(service) } @@ -62,7 +62,7 @@ func (s *restartController) restartOne(app v1.AppService) error { } if err := stopController.stopOne(app); err != nil { if err != ErrWaitTimeOut { - app.Logger.Error("(Restart)Stop app failure %s,you could waiting stoped and manual start it", util.GetCallbackLoggerOption()) + app.Logger.Error("(Restart)Stop app failure %s,you could waiting stoped and manual start it", event.GetCallbackLoggerOption()) return err } //waiting app closed,max wait 40 second @@ -82,7 +82,7 @@ func (s *restartController) restartOne(app v1.AppService) error { newAppService, err := conversion.InitAppService(db.GetManager(), app.ServiceID, app.ExtensionSet) if err != nil { logrus.Errorf("Application model init create failure:%s", err.Error()) - app.Logger.Error("Application model init create failure", util.GetCallbackLoggerOption()) + app.Logger.Error("Application model init create failure", event.GetCallbackLoggerOption()) return fmt.Errorf("Application model init create failure,%s", err.Error()) } newAppService.Logger = app.Logger diff --git a/worker/appm/controller/scaling.go b/worker/appm/controller/scaling.go index 5cb4dbe61..26aeebfb1 100644 --- a/worker/appm/controller/scaling.go +++ b/worker/appm/controller/scaling.go @@ -20,12 +20,12 @@ package controller import ( "fmt" - "github.com/goodrain/rainbond/worker/util" "math" "sync" "time" "github.com/Sirupsen/logrus" + "github.com/goodrain/rainbond/event" v1 "github.com/goodrain/rainbond/worker/appm/types/v1" types "k8s.io/apimachinery/pkg/types" ) @@ -44,16 +44,16 @@ func (s *scalingController) Begin() { go func(service v1.AppService) { wait.Add(1) defer wait.Done() - service.Logger.Info("App runtime begin horizontal scaling app service "+service.ServiceAlias, util.GetLoggerOption("starting")) + service.Logger.Info("App runtime begin horizontal scaling app service "+service.ServiceAlias, event.GetLoggerOption("starting")) if err := s.scalingOne(service); err != nil { if err != ErrWaitTimeOut { - service.Logger.Error(fmt.Sprintf("horizontal scaling service %s failure %s", service.ServiceAlias, err.Error()), util.GetCallbackLoggerOption()) + service.Logger.Error(fmt.Sprintf("horizontal scaling service %s failure %s", service.ServiceAlias, err.Error()), event.GetCallbackLoggerOption()) logrus.Errorf("horizontal scaling service %s failure %s", service.ServiceAlias, err.Error()) } else { - service.Logger.Error(fmt.Sprintf("horizontal scaling service timeout,please waiting it complete"), util.GetTimeoutLoggerOption()) + service.Logger.Error(fmt.Sprintf("horizontal scaling service timeout,please waiting it complete"), event.GetTimeoutLoggerOption()) } } else { - service.Logger.Info(fmt.Sprintf("horizontal scaling service %s success", service.ServiceAlias), util.GetLastLoggerOption()) + service.Logger.Info(fmt.Sprintf("horizontal scaling service %s success", service.ServiceAlias), event.GetLastLoggerOption()) } }(service) } diff --git a/worker/appm/controller/start.go b/worker/appm/controller/start.go index 1c136e3e6..249e74362 100644 --- a/worker/appm/controller/start.go +++ b/worker/appm/controller/start.go @@ -20,15 +20,13 @@ package controller import ( "fmt" - "github.com/goodrain/rainbond/worker/util" "sync" "time" - "k8s.io/apimachinery/pkg/api/errors" - "github.com/Sirupsen/logrus" + "github.com/goodrain/rainbond/event" v1 "github.com/goodrain/rainbond/worker/appm/types/v1" - + "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -56,19 +54,19 @@ func (s *startController) Begin() { wait.Add(1) defer wait.Done() logrus.Debugf("App runtime begin start app service(%s)", service.ServiceAlias) - service.Logger.Info("App runtime begin start app service "+service.ServiceAlias, util.GetLoggerOption("starting")) + service.Logger.Info("App runtime begin start app service "+service.ServiceAlias, event.GetLoggerOption("starting")) if err := s.startOne(service); err != nil { if err != ErrWaitTimeOut { - service.Logger.Error(fmt.Sprintf("Start service %s failure %s", service.ServiceAlias, err.Error()), util.GetCallbackLoggerOption()) + service.Logger.Error(fmt.Sprintf("Start service %s failure %s", service.ServiceAlias, err.Error()), event.GetCallbackLoggerOption()) logrus.Errorf("start service %s failure %s", service.ServiceAlias, err.Error()) s.errorCallback(service) } else { logrus.Debugf("Start service %s timeout, please wait or read service log.", service.ServiceAlias) - service.Logger.Error(fmt.Sprintf("Start service %s timeout,please wait or read service log.", service.ServiceAlias), util.GetTimeoutLoggerOption()) + service.Logger.Error(fmt.Sprintf("Start service %s timeout,please wait or read service log.", service.ServiceAlias), event.GetTimeoutLoggerOption()) } } else { logrus.Debugf("Start service %s success", service.ServiceAlias) - service.Logger.Info(fmt.Sprintf("Start service %s success", service.ServiceAlias), util.GetLastLoggerOption()) + service.Logger.Info(fmt.Sprintf("Start service %s success", service.ServiceAlias), event.GetLastLoggerOption()) } }(*service) } @@ -77,13 +75,13 @@ func (s *startController) Begin() { } } func (s *startController) errorCallback(app v1.AppService) error { - app.Logger.Info("Begin clean resources that have been created", util.GetLoggerOption("starting")) + app.Logger.Info("Begin clean resources that have been created", event.GetLoggerOption("starting")) stopController := stopController{ manager: s.manager, } if err := stopController.stopOne(app); err != nil { logrus.Errorf("stop app failure after start failure. %s", err.Error()) - app.Logger.Error(fmt.Sprintf("Stop app failure %s", app.ServiceAlias), util.GetLoggerOption("failure")) + app.Logger.Error(fmt.Sprintf("Stop app failure %s", app.ServiceAlias), event.GetLoggerOption("failure")) return err } return nil @@ -146,7 +144,7 @@ func (s *startController) startOne(app v1.AppService) error { } } //step 6: waiting endpoint ready - app.Logger.Info("Create all app model success, will waiting app ready", util.GetLoggerOption("running")) + app.Logger.Info("Create all app model success, will waiting app ready", event.GetLoggerOption("running")) return s.WaitingReady(app) } diff --git a/worker/appm/controller/stop.go b/worker/appm/controller/stop.go index c97ec4572..05a453201 100644 --- a/worker/appm/controller/stop.go +++ b/worker/appm/controller/stop.go @@ -20,14 +20,13 @@ package controller import ( "fmt" - "github.com/goodrain/rainbond/worker/util" "sync" "time" - "k8s.io/apimachinery/pkg/api/errors" - "github.com/Sirupsen/logrus" + "github.com/goodrain/rainbond/event" v1 "github.com/goodrain/rainbond/worker/appm/types/v1" + "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -45,16 +44,16 @@ func (s *stopController) Begin() { go func(service v1.AppService) { wait.Add(1) defer wait.Done() - service.Logger.Info("App runtime begin stop app service "+service.ServiceAlias, util.GetLoggerOption("starting")) + service.Logger.Info("App runtime begin stop app service "+service.ServiceAlias, event.GetLoggerOption("starting")) if err := s.stopOne(service); err != nil { if err != ErrWaitTimeOut { - service.Logger.Error(fmt.Sprintf("stop service %s failure %s", service.ServiceAlias, err.Error()), util.GetCallbackLoggerOption()) + service.Logger.Error(fmt.Sprintf("stop service %s failure %s", service.ServiceAlias, err.Error()), event.GetCallbackLoggerOption()) logrus.Errorf("stop service %s failure %s", service.ServiceAlias, err.Error()) } else { - service.Logger.Error(fmt.Sprintf("stop service timeout,please waiting it closed"), util.GetTimeoutLoggerOption()) + service.Logger.Error(fmt.Sprintf("stop service timeout,please waiting it closed"), event.GetTimeoutLoggerOption()) } } else { - service.Logger.Info(fmt.Sprintf("stop service %s success", service.ServiceAlias), util.GetLastLoggerOption()) + service.Logger.Info(fmt.Sprintf("stop service %s success", service.ServiceAlias), event.GetLastLoggerOption()) } }(service) } @@ -140,7 +139,7 @@ func (s *stopController) stopOne(app v1.AppService) error { } } //step 7: waiting endpoint ready - app.Logger.Info("Delete all app model success, will waiting app closed", util.GetLoggerOption("running")) + app.Logger.Info("Delete all app model success, will waiting app closed", event.GetLoggerOption("running")) return s.WaitingReady(app) } func (s *stopController) Stop() error { diff --git a/worker/appm/controller/upgrade.go b/worker/appm/controller/upgrade.go index 253e635d1..17f925849 100644 --- a/worker/appm/controller/upgrade.go +++ b/worker/appm/controller/upgrade.go @@ -20,13 +20,12 @@ package controller import ( "fmt" - "github.com/goodrain/rainbond/worker/util" "sync" "time" - "github.com/goodrain/rainbond/worker/appm/f" - "github.com/Sirupsen/logrus" + "github.com/goodrain/rainbond/event" + "github.com/goodrain/rainbond/worker/appm/f" v1 "github.com/goodrain/rainbond/worker/appm/types/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -47,16 +46,16 @@ func (s *upgradeController) Begin() { go func(service v1.AppService) { wait.Add(1) defer wait.Done() - service.Logger.Info("App runtime begin upgrade app service "+service.ServiceAlias, util.GetLoggerOption("starting")) + service.Logger.Info("App runtime begin upgrade app service "+service.ServiceAlias, event.GetLoggerOption("starting")) if err := s.upgradeOne(service); err != nil { if err != ErrWaitTimeOut { - service.Logger.Error(fmt.Sprintf("upgrade service %s failure %s", service.ServiceAlias, err.Error()), util.GetCallbackLoggerOption()) + service.Logger.Error(fmt.Sprintf("upgrade service %s failure %s", service.ServiceAlias, err.Error()), event.GetCallbackLoggerOption()) logrus.Errorf("upgrade service %s failure %s", service.ServiceAlias, err.Error()) } else { - service.Logger.Error(fmt.Sprintf("upgrade service timeout,please waiting it complete"), util.GetTimeoutLoggerOption()) + service.Logger.Error(fmt.Sprintf("upgrade service timeout,please waiting it complete"), event.GetTimeoutLoggerOption()) } } else { - service.Logger.Info(fmt.Sprintf("upgrade service %s success", service.ServiceAlias), util.GetLastLoggerOption()) + service.Logger.Info(fmt.Sprintf("upgrade service %s success", service.ServiceAlias), event.GetLastLoggerOption()) } }(service) } @@ -158,14 +157,14 @@ func (s *upgradeController) upgradeOne(app v1.AppService) error { if deployment := app.GetDeployment(); deployment != nil { _, err := s.manager.client.AppsV1().Deployments(deployment.Namespace).Patch(deployment.Name, types.MergePatchType, app.UpgradePatch["deployment"]) if err != nil { - app.Logger.Error(fmt.Sprintf("upgrade deployment %s failure %s", app.ServiceAlias, err.Error()), util.GetLoggerOption("failure")) + app.Logger.Error(fmt.Sprintf("upgrade deployment %s failure %s", app.ServiceAlias, err.Error()), event.GetLoggerOption("failure")) return fmt.Errorf("upgrade deployment %s failure %s", app.ServiceAlias, err.Error()) } } if statefulset := app.GetStatefulSet(); statefulset != nil { _, err := s.manager.client.AppsV1().StatefulSets(statefulset.Namespace).Patch(statefulset.Name, types.MergePatchType, app.UpgradePatch["statefulset"]) if err != nil { - app.Logger.Error(fmt.Sprintf("upgrade statefulset %s failure %s", app.ServiceAlias, err.Error()), util.GetLoggerOption("failure")) + app.Logger.Error(fmt.Sprintf("upgrade statefulset %s failure %s", app.ServiceAlias, err.Error()), event.GetLoggerOption("failure")) return fmt.Errorf("upgrade statefulset %s failure %s", app.ServiceAlias, err.Error()) } } diff --git a/worker/appm/store/store.go b/worker/appm/store/store.go index 4196fb451..6036bca94 100644 --- a/worker/appm/store/store.go +++ b/worker/appm/store/store.go @@ -1021,7 +1021,7 @@ func (a *appRuntimeStore) podEventHandler() cache.ResourceEventHandler { defer event.GetManager().ReleaseLogger(logger) logrus.Debugf(fmt.Sprintf("instance changed; old instance: %s; new instance: %s", opod.GetName(), npod.GetName())) logger.Info(fmt.Sprintf("instance changed; old instance: %s; new instance: %s", opod.GetName(), npod.GetName()), nil) - logger.Info(fmt.Sprintf("instance changed; old status: %s; new status: %s", oldPodStatus.Type.String(), newPodStatus.Type.String()), wutil.GetLastLoggerOption()) + logger.Info(fmt.Sprintf("instance changed; old status: %s; new status: %s", oldPodStatus.Type.String(), newPodStatus.Type.String()), event.GetLastLoggerOption()) } return } @@ -1035,7 +1035,7 @@ func (a *appRuntimeStore) podEventHandler() cache.ResourceEventHandler { logger := event.GetManager().GetLogger(eventID) defer event.GetManager().ReleaseLogger(logger) logrus.Debugf(fmt.Sprintf("instance deleted %s", pod.GetName())) - logger.Info(fmt.Sprintf("instance deleted %s", pod.GetName()), wutil.GetLastLoggerOption()) + logger.Info(fmt.Sprintf("instance deleted %s", pod.GetName()), event.GetLastLoggerOption()) } if serviceID != "" && version != "" && creatorID != "" { appservice, _ := a.getAppService(serviceID, version, creatorID, false) diff --git a/worker/handle/manager.go b/worker/handle/manager.go index c7b9c3e95..f4d2927a6 100644 --- a/worker/handle/manager.go +++ b/worker/handle/manager.go @@ -35,7 +35,6 @@ import ( "github.com/goodrain/rainbond/worker/appm/store" v1 "github.com/goodrain/rainbond/worker/appm/types/v1" "github.com/goodrain/rainbond/worker/discover/model" - util "github.com/goodrain/rainbond/worker/util" ) //Manager manager @@ -129,14 +128,14 @@ func (m *Manager) startExec(task *model.Task) error { logger := event.GetManager().GetLogger(body.EventID) appService := m.store.GetAppService(body.ServiceID) if appService != nil && !appService.IsClosed() { - logger.Info("Application is not closed, can not start", util.GetLastLoggerOption()) + logger.Info("Application is not closed, can not start", event.GetLastLoggerOption()) event.GetManager().ReleaseLogger(logger) return nil } newAppService, err := conversion.InitAppService(m.dbmanager, body.ServiceID, body.Configs) if err != nil { logrus.Errorf("Application init create failure:%s", err.Error()) - logger.Error("Application init create failure", util.GetCallbackLoggerOption()) + logger.Error("Application init create failure", event.GetCallbackLoggerOption()) event.GetManager().ReleaseLogger(logger) return fmt.Errorf("Application init create failure") } @@ -146,7 +145,7 @@ func (m *Manager) startExec(task *model.Task) error { err = m.controllerManager.StartController(controller.TypeStartController, *newAppService) if err != nil { logrus.Errorf("Application run start controller failure:%s", err.Error()) - logger.Error("Application run start controller failure", util.GetCallbackLoggerOption()) + logger.Error("Application run start controller failure", event.GetCallbackLoggerOption()) event.GetManager().ReleaseLogger(logger) return fmt.Errorf("Application start failure") } @@ -163,7 +162,7 @@ func (m *Manager) stopExec(task *model.Task) error { logger := event.GetManager().GetLogger(body.EventID) appService := m.store.GetAppService(body.ServiceID) if appService == nil { - logger.Info("Application is closed, can not stop", util.GetLastLoggerOption()) + logger.Info("Application is closed, can not stop", event.GetLastLoggerOption()) event.GetManager().ReleaseLogger(logger) return nil } @@ -174,7 +173,7 @@ func (m *Manager) stopExec(task *model.Task) error { err := m.controllerManager.StartController(controller.TypeStopController, *appService) if err != nil { logrus.Errorf("Application run stop controller failure:%s", err.Error()) - logger.Info("Application run stop controller failure", util.GetCallbackLoggerOption()) + logger.Info("Application run stop controller failure", event.GetCallbackLoggerOption()) event.GetManager().ReleaseLogger(logger) return fmt.Errorf("Application stop failure") } @@ -191,7 +190,7 @@ func (m *Manager) restartExec(task *model.Task) error { logger := event.GetManager().GetLogger(body.EventID) appService := m.store.GetAppService(body.ServiceID) if appService == nil { - logger.Info("Application is closed, can not stop", util.GetLastLoggerOption()) + logger.Info("Application is closed, can not stop", event.GetLastLoggerOption()) event.GetManager().ReleaseLogger(logger) return nil } @@ -203,7 +202,7 @@ func (m *Manager) restartExec(task *model.Task) error { err := m.controllerManager.StartController(controller.TypeRestartController, *appService) if err != nil { logrus.Errorf("Application run restart controller failure:%s", err.Error()) - logger.Info("Application run restart controller failure", util.GetCallbackLoggerOption()) + logger.Info("Application run restart controller failure", event.GetCallbackLoggerOption()) event.GetManager().ReleaseLogger(logger) return fmt.Errorf("Application restart failure") } @@ -220,14 +219,14 @@ func (m *Manager) horizontalScalingExec(task *model.Task) error { logger := event.GetManager().GetLogger(body.EventID) service, err := db.GetManager().TenantServiceDao().GetServiceByID(body.ServiceID) if err != nil { - logger.Error("Get app base info failure", util.GetCallbackLoggerOption()) + logger.Error("Get app base info failure", event.GetCallbackLoggerOption()) event.GetManager().ReleaseLogger(logger) logrus.Errorf("horizontal_scaling get rc error. %v", err) return fmt.Errorf("a") } appService := m.store.GetAppService(body.ServiceID) if appService == nil || appService.IsClosed() { - logger.Info("service is closed,no need handle", util.GetLastLoggerOption()) + logger.Info("service is closed,no need handle", event.GetLastLoggerOption()) return nil } appService.Logger = logger @@ -235,7 +234,7 @@ func (m *Manager) horizontalScalingExec(task *model.Task) error { err = m.controllerManager.StartController(controller.TypeScalingController, *appService) if err != nil { logrus.Errorf("Application run scaling controller failure:%s", err.Error()) - logger.Info("Application run scaling controller failure", util.GetCallbackLoggerOption()) + logger.Info("Application run scaling controller failure", event.GetCallbackLoggerOption()) event.GetManager().ReleaseLogger(logger) return fmt.Errorf("Application scaling failure") } @@ -253,13 +252,13 @@ func (m *Manager) verticalScalingExec(task *model.Task) error { service, err := db.GetManager().TenantServiceDao().GetServiceByID(body.ServiceID) if err != nil { logrus.Errorf("vertical_scaling get rc error. %v", err) - logger.Error("Get app base info failure", util.GetCallbackLoggerOption()) + logger.Error("Get app base info failure", event.GetCallbackLoggerOption()) event.GetManager().ReleaseLogger(logger) return fmt.Errorf("vertical_scaling get rc error. %v", err) } appService := m.store.GetAppService(body.ServiceID) if appService == nil || appService.IsClosed() { - logger.Info("service is closed,no need handle", util.GetLastLoggerOption()) + logger.Info("service is closed,no need handle", event.GetLastLoggerOption()) event.GetManager().ReleaseLogger(logger) return nil } @@ -269,7 +268,7 @@ func (m *Manager) verticalScalingExec(task *model.Task) error { newAppService, err := conversion.InitAppService(m.dbmanager, body.ServiceID, nil) if err != nil { logrus.Errorf("Application init create failure:%s", err.Error()) - logger.Error("Application init create failure", util.GetCallbackLoggerOption()) + logger.Error("Application init create failure", event.GetCallbackLoggerOption()) event.GetManager().ReleaseLogger(logger) return fmt.Errorf("Application init create failure") } @@ -278,7 +277,7 @@ func (m *Manager) verticalScalingExec(task *model.Task) error { err = m.controllerManager.StartController(controller.TypeUpgradeController, *newAppService) if err != nil { logrus.Errorf("Application run vertical scaling(upgrade) controller failure:%s", err.Error()) - logger.Info("Application run vertical scaling(upgrade) controller failure", util.GetCallbackLoggerOption()) + logger.Info("Application run vertical scaling(upgrade) controller failure", event.GetCallbackLoggerOption()) event.GetManager().ReleaseLogger(logger) return fmt.Errorf("Application vertical scaling(upgrade) failure") } @@ -296,7 +295,7 @@ func (m *Manager) rollingUpgradeExec(task *model.Task) error { newAppService, err := conversion.InitAppService(m.dbmanager, body.ServiceID, body.Configs) if err != nil { logrus.Errorf("Application init create failure:%s", err.Error()) - logger.Error("Application init create failure", util.GetCallbackLoggerOption()) + logger.Error("Application init create failure", event.GetCallbackLoggerOption()) event.GetManager().ReleaseLogger(logger) return fmt.Errorf("Application init create failure") } @@ -309,7 +308,7 @@ func (m *Manager) rollingUpgradeExec(task *model.Task) error { err = m.controllerManager.StartController(controller.TypeStartController, *newAppService) if err != nil { logrus.Errorf("Application run start controller failure:%s", err.Error()) - logger.Info("Application run start controller failure", util.GetCallbackLoggerOption()) + logger.Info("Application run start controller failure", event.GetCallbackLoggerOption()) event.GetManager().ReleaseLogger(logger) return fmt.Errorf("Application start failure") } @@ -318,18 +317,18 @@ func (m *Manager) rollingUpgradeExec(task *model.Task) error { } if err := oldAppService.SetUpgradePatch(newAppService); err != nil { if err.Error() == "no upgrade" { - logger.Info("Application no change no need upgrade.", util.GetLastLoggerOption()) + logger.Info("Application no change no need upgrade.", event.GetLastLoggerOption()) return nil } logrus.Errorf("Application get upgrade info error:%s", err.Error()) - logger.Error(fmt.Sprintf("Application get upgrade info error:%s", err.Error()), util.GetCallbackLoggerOption()) + logger.Error(fmt.Sprintf("Application get upgrade info error:%s", err.Error()), event.GetCallbackLoggerOption()) return nil } //if service already deploy,upgrade it: err = m.controllerManager.StartController(controller.TypeUpgradeController, *newAppService) if err != nil { logrus.Errorf("Application run upgrade controller failure:%s", err.Error()) - logger.Info("Application run upgrade controller failure", util.GetCallbackLoggerOption()) + logger.Info("Application run upgrade controller failure", event.GetCallbackLoggerOption()) event.GetManager().ReleaseLogger(logger) return fmt.Errorf("Application upgrade failure") } @@ -354,7 +353,7 @@ func (m *Manager) applyRuleExec(task *model.Task) error { if svc.Kind != dbmodel.ServiceKindThirdParty.String() && !strings.HasPrefix(body.Action, "port") { if oldAppService == nil || oldAppService.IsClosed() { logrus.Debugf("service is closed, no need handle") - logger.Info("service is closed,no need handle", util.GetLastLoggerOption()) + logger.Info("service is closed,no need handle", event.GetLastLoggerOption()) event.GetManager().ReleaseLogger(logger) return nil } @@ -368,7 +367,7 @@ func (m *Manager) applyRuleExec(task *model.Task) error { } if err != nil { logrus.Errorf("Application init create failure:%s", err.Error()) - logger.Error("Application init create failure", util.GetCallbackLoggerOption()) + logger.Error("Application init create failure", event.GetCallbackLoggerOption()) event.GetManager().ReleaseLogger(logger) return fmt.Errorf("Application init create failure") }