[ADD] add debug messages

This commit is contained in:
GLYASAI 2018-12-20 14:51:19 +08:00
parent b8ee1f2fed
commit 4d2d9ac21b
2 changed files with 5 additions and 0 deletions

View File

@ -21,6 +21,7 @@ package v1
import (
"crypto/sha256"
"fmt"
"github.com/Sirupsen/logrus"
"time"
corev1 "k8s.io/api/core/v1"
@ -35,12 +36,15 @@ func (a *AppService) IsEmpty() bool {
//IsClosed is closed
func (a *AppService) IsClosed() bool {
if a.IsEmpty() && a.statefulset == nil && a.deployment == nil {
logrus.Debugf("a.IsEmpty() && a.statefulset == nil && a.deployment == nil")
return true
}
if a.IsEmpty() && a.statefulset != nil && a.statefulset.ResourceVersion == "" {
logrus.Debugf("a.IsEmpty() && a.statefulset != nil && a.statefulset.ResourceVersion == \"\"")
return true
}
if a.IsEmpty() && a.deployment != nil && a.deployment.ResourceVersion == "" {
logrus.Debugf("a.IsEmpty() && a.deployment != nil && a.deployment.ResourceVersion == \"\"")
return true
}
return false

View File

@ -329,6 +329,7 @@ func (m *Manager) applyRuleExec(task *model.Task) error {
}
logger := event.GetManager().GetLogger(body.EventID)
oldAppService := m.store.GetAppService(body.ServiceID)
logrus.Debugf("oldAppService: %v", oldAppService)
if (oldAppService == nil || oldAppService.IsClosed()) && !strings.Contains(body.Action, "port") {
logrus.Debugf("service is closed,no need handle")
logger.Info("service is closed,no need handle", controller.GetLastLoggerOption())