From 1055111b5e7c7e57cc0c03493c48f66924ba702c Mon Sep 17 00:00:00 2001 From: hongming Date: Wed, 5 Dec 2018 21:30:44 +0800 Subject: [PATCH] fix: miscount Signed-off-by: hongming --- pkg/models/controllers/clusterroles.go | 4 ++-- pkg/models/controllers/roles.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/models/controllers/clusterroles.go b/pkg/models/controllers/clusterroles.go index 6e742637c..63ccf777f 100644 --- a/pkg/models/controllers/clusterroles.go +++ b/pkg/models/controllers/clusterroles.go @@ -86,13 +86,13 @@ func (ctl *ClusterRoleCtl) sync(stopChan chan struct{}) { func (ctl *ClusterRoleCtl) total() int { list, err := ctl.lister.List(labels.Everything()) if err != nil { - glog.Errorf("count %s falied, reason:%s", err, ctl.Name()) + glog.Errorf("count %s failed, reason:%s", err, ctl.Name()) return 0 } count := 0 for _, item := range list { - if !strings.HasPrefix(item.Name, systemPrefix) { + if !strings.HasPrefix(item.Name, systemPrefix) && item.Annotations != nil && len(item.Annotations[creator]) > 0 { count++ } } diff --git a/pkg/models/controllers/roles.go b/pkg/models/controllers/roles.go index bf294648f..3dc6eea52 100644 --- a/pkg/models/controllers/roles.go +++ b/pkg/models/controllers/roles.go @@ -88,13 +88,13 @@ func (ctl *RoleCtl) sync(stopChan chan struct{}) { func (ctl *RoleCtl) total() int { list, err := ctl.lister.List(labels.Everything()) if err != nil { - glog.Errorf("count %s falied, reason:%s", err, ctl.Name()) + glog.Errorf("count %s failed, reason:%s", err, ctl.Name()) return 0 } count := 0 for _, item := range list { - if !strings.HasPrefix(item.Name, systemPrefix) { + if !strings.HasPrefix(item.Name, systemPrefix) && item.Annotations != nil && len(item.Annotations[creator]) > 0 { count++ } }