From 6a0d5ba93c0c7ad0aafc74292346559ea0e8efd4 Mon Sep 17 00:00:00 2001 From: KubeSphere CI Bot <47586280+ks-ci-bot@users.noreply.github.com> Date: Sat, 8 Oct 2022 13:58:57 +0800 Subject: [PATCH] [release-3.3] Fix: Can not resolve the resource scope correctly (#5274) Fix: can not resolve the resource scope of clusters.cluster.kubesphere.io correctly Signed-off-by: Wenhao Zhou Signed-off-by: Wenhao Zhou Co-authored-by: Wenhao Zhou --- pkg/apiserver/request/requestinfo.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/apiserver/request/requestinfo.go b/pkg/apiserver/request/requestinfo.go index a6227f081..ee1e63c33 100644 --- a/pkg/apiserver/request/requestinfo.go +++ b/pkg/apiserver/request/requestinfo.go @@ -246,8 +246,6 @@ func (r *RequestInfoFactory) NewRequestInfo(req *http.Request) (*RequestInfo, er // parsing successful, so we now know the proper value for .Parts requestInfo.Parts = currentParts - requestInfo.ResourceScope = r.resolveResourceScope(requestInfo) - // parts look like: resource/resourceName/subresource/other/stuff/we/don't/interpret switch { case len(requestInfo.Parts) >= 3 && !specialVerbsNoSubresources.Has(requestInfo.Verb): @@ -260,6 +258,8 @@ func (r *RequestInfoFactory) NewRequestInfo(req *http.Request) (*RequestInfo, er requestInfo.Resource = requestInfo.Parts[0] } + requestInfo.ResourceScope = r.resolveResourceScope(requestInfo) + // if there's no name on the request and we thought it was a get before, then the actual verb is a list or a watch if len(requestInfo.Name) == 0 && requestInfo.Verb == "get" { opts := metainternalversion.ListOptions{}