apiserver: avoid repeated loading context for requestInfo in Namer.Name

Kubernetes-commit: 9cee586ee98bf7b5377ea04a8980f7f3fdbe5ec2
This commit is contained in:
j2gg0s 2021-07-28 19:04:48 +08:00 committed by Kubernetes Publisher
parent bc98e6b23d
commit 1f934a9364
1 changed files with 1 additions and 5 deletions

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