Merge pull request #103999 from j2gg0s/avoid-duplicate-load-context

apiserver: avoid repeated loading context for requestInfo in Namer.Name
This commit is contained in:
Kubernetes Prow Robot 2021-08-05 14:11:18 -07:00 committed by GitHub
commit 290af62bb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,15 +76,11 @@ func (n ContextBasedNaming) Name(req *http.Request) (namespace, name string, err
if !ok {
return "", "", fmt.Errorf("missing requestInfo")
}
ns, err := n.Namespace(req)
if err != nil {
return "", "", err
}
if len(requestInfo.Name) == 0 {
return "", "", errEmptyName
}
return ns, requestInfo.Name, nil
return requestInfo.Namespace, requestInfo.Name, nil
}
// fastURLPathEncode encodes the provided path as a URL path