fix: ks-account abnormal restart

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
hongming
2019-04-16 15:31:37 +08:00
committed by zryfish
parent 5c8a087a9c
commit dd963c0be4
40 changed files with 394 additions and 314 deletions

View File

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