fix: ks-account abnormal restart
Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
@@ -19,6 +19,7 @@ package resources
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/golang/glog"
|
||||
"kubesphere.io/kubesphere/pkg/models"
|
||||
"kubesphere.io/kubesphere/pkg/params"
|
||||
"kubesphere.io/kubesphere/pkg/utils/sliceutil"
|
||||
@@ -56,12 +57,12 @@ var (
|
||||
|
||||
const (
|
||||
Name = "name"
|
||||
label = "label"
|
||||
ownerKind = "ownerKind"
|
||||
ownerName = "ownerName"
|
||||
Label = "label"
|
||||
OwnerKind = "ownerKind"
|
||||
OwnerName = "ownerName"
|
||||
CreateTime = "createTime"
|
||||
updateTime = "updateTime"
|
||||
lastScheduleTime = "lastScheduleTime"
|
||||
UpdateTime = "updateTime"
|
||||
LastScheduleTime = "lastScheduleTime"
|
||||
chart = "chart"
|
||||
release = "release"
|
||||
annotation = "annotation"
|
||||
@@ -106,6 +107,7 @@ func GetResource(namespace, resource, name string) (interface{}, error) {
|
||||
if searcher, ok := resources[resource]; ok {
|
||||
resource, err := searcher.get(namespace, name)
|
||||
if err != nil {
|
||||
glog.Errorln("get resource", namespace, resource, name, err)
|
||||
return nil, err
|
||||
}
|
||||
return resource, nil
|
||||
@@ -120,16 +122,19 @@ func ListResources(namespace, resource string, conditions *params.Conditions, or
|
||||
|
||||
// none namespace resource
|
||||
if namespace != "" && sliceutil.HasString(clusterResources, resource) {
|
||||
glog.Errorln("resources not found", resource)
|
||||
return nil, fmt.Errorf("not found")
|
||||
}
|
||||
|
||||
if searcher, ok := resources[resource]; ok {
|
||||
result, err = searcher.search(namespace, conditions, orderBy, reverse)
|
||||
} else {
|
||||
glog.Errorln("resources not found", resource)
|
||||
return nil, fmt.Errorf("not found")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
glog.Errorln("resources search", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user