diff --git a/pkg/models/controllers/clusterroles.go b/pkg/models/controllers/clusterroles.go index 6e742637cf99f388b28566b3b34f5223cbacd6f2..63ccf777fa0139a1fb15eb735ccd43c470fc65eb 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 bf294648f54b179b6ee4917bb31a8ba10a26c3f6..3dc6eea52e8c3142cd85cb378841d9a960ea8736 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++ } }