Merge pull request #229 from wansir/master

fix: miscount
This commit is contained in:
zryfish
2018-12-06 00:28:44 +08:00
committed by GitHub
2 changed files with 4 additions and 4 deletions

View File

@@ -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++
}
}

View File

@@ -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++
}
}