Fix cannot get registered resource (#5515)

* Fix can`t get registered resource

Signed-off-by: wenhaozhou <wenhaozhou@yunify.com>

* update v1beta1 interface Get func`s parameters

Signed-off-by: wenhaozhou <wenhaozhou@yunify.com>

---------

Signed-off-by: wenhaozhou <wenhaozhou@yunify.com>
This commit is contained in:
Wenhao Zhou
2023-02-15 10:50:23 +08:00
committed by GitHub
parent 2cd5f45d47
commit b143b41e3c
3 changed files with 3 additions and 3 deletions

View File

@@ -66,7 +66,7 @@ func (u *unregisteredMiddleware) Handle(w http.ResponseWriter, req *http.Request
rootPath := fmt.Sprintf("/kapis/%s/%s", gvr.Group, gvr.Version)
if u.registeredGv.Has(rootPath) {
return true
return false
}
var (

View File

@@ -19,7 +19,7 @@ func NewResourceCache(cache cache.Cache) Interface {
return &resourceCache{cache: cache}
}
func (u *resourceCache) Get(name, namespace string, object client.Object) error {
func (u *resourceCache) Get(namespace, name string, object client.Object) error {
return u.cache.Get(context.Background(), client.ObjectKey{Namespace: namespace, Name: name}, object)
}

View File

@@ -64,7 +64,7 @@ func (h *resourceGetter) GetResource(gvr schema.GroupVersionResource, name, name
obj = u
}
if err := h.cache.Get(name, namespace, obj); err != nil {
if err := h.cache.Get(namespace, name, obj); err != nil {
return nil, err
}
return obj, nil