diff --git a/pkg/models/controllers/clusterroles.go b/pkg/models/controllers/clusterroles.go index bd74540ef..ed5a47e5c 100644 --- a/pkg/models/controllers/clusterroles.go +++ b/pkg/models/controllers/clusterroles.go @@ -36,7 +36,7 @@ func (ctl *ClusterRoleCtl) generateObject(item v1.ClusterRole) *ClusterRole { } name := item.Name - if strings.HasPrefix(name, systemPrefix) { + if strings.HasPrefix(name, systemPrefix) || item.Annotations == nil || len(item.Annotations[creator]) == 0 { return nil } diff --git a/pkg/models/controllers/roles.go b/pkg/models/controllers/roles.go index 8116ae5f4..bf294648f 100644 --- a/pkg/models/controllers/roles.go +++ b/pkg/models/controllers/roles.go @@ -30,12 +30,12 @@ import ( func (ctl *RoleCtl) generateObject(item v1.Role) *Role { var displayName string - if item.Annotations != nil && len(item.Annotations[DisplayName]) > 0 { + if item.Annotations != nil && len(item.Annotations[DisplayName]) == 0 { displayName = item.Annotations[DisplayName] } name := item.Name - if strings.HasPrefix(name, systemPrefix) { + if strings.HasPrefix(name, systemPrefix) || item.Annotations == nil || len(item.Annotations[creator]) == 0 { return nil } namespace := item.Namespace diff --git a/pkg/models/controllers/types.go b/pkg/models/controllers/types.go index d73d4bc07..7ccd95b11 100644 --- a/pkg/models/controllers/types.go +++ b/pkg/models/controllers/types.go @@ -49,6 +49,7 @@ const ( Warning = "warning" Error = "error" DisplayName = "displayName" + creator = "creator" Pods = "pods" Deployments = "deployments"