mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
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:
commit
290af62bb0
@ -76,15 +76,11 @@ func (n ContextBasedNaming) Name(req *http.Request) (namespace, name string, err
|
|||||||
if !ok {
|
if !ok {
|
||||||
return "", "", fmt.Errorf("missing requestInfo")
|
return "", "", fmt.Errorf("missing requestInfo")
|
||||||
}
|
}
|
||||||
ns, err := n.Namespace(req)
|
|
||||||
if err != nil {
|
|
||||||
return "", "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(requestInfo.Name) == 0 {
|
if len(requestInfo.Name) == 0 {
|
||||||
return "", "", errEmptyName
|
return "", "", errEmptyName
|
||||||
}
|
}
|
||||||
return ns, requestInfo.Name, nil
|
return requestInfo.Namespace, requestInfo.Name, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// fastURLPathEncode encodes the provided path as a URL path
|
// fastURLPathEncode encodes the provided path as a URL path
|
||||||
|
Loading…
Reference in New Issue
Block a user