@@ -24,7 +24,9 @@ import (
|
||||
"kubesphere.io/kubesphere/pkg/constants"
|
||||
"kubesphere.io/kubesphere/pkg/informers"
|
||||
"kubesphere.io/kubesphere/pkg/models/iam"
|
||||
"kubesphere.io/kubesphere/pkg/models/resources"
|
||||
"kubesphere.io/kubesphere/pkg/params"
|
||||
"kubesphere.io/kubesphere/pkg/utils/sliceutil"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
@@ -36,11 +38,12 @@ type namespaceSearcher struct {
|
||||
func (*namespaceSearcher) match(match map[string]string, item *v1.Namespace) bool {
|
||||
for k, v := range match {
|
||||
switch k {
|
||||
case "name":
|
||||
if item.Name != v && item.Labels[constants.DisplayNameLabelKey] != v {
|
||||
case resources.Name:
|
||||
names := strings.Split(v, "|")
|
||||
if !sliceutil.HasString(names, item.Name) {
|
||||
return false
|
||||
}
|
||||
case "keyword":
|
||||
case resources.Keyword:
|
||||
if !strings.Contains(item.Name, v) && !contains(item.Labels, "", v) && !contains(item.Annotations, "", v) {
|
||||
return false
|
||||
}
|
||||
@@ -57,8 +60,8 @@ func (*namespaceSearcher) fuzzy(fuzzy map[string]string, item *v1.Namespace) boo
|
||||
|
||||
for k, v := range fuzzy {
|
||||
switch k {
|
||||
case "name":
|
||||
if !strings.Contains(item.Name, v) && !strings.Contains(item.Labels["displayName"], v) {
|
||||
case resources.Name:
|
||||
if !strings.Contains(item.Name, v) && !strings.Contains(item.Annotations[constants.DisplayNameAnnotationKey], v) {
|
||||
return false
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user