mirror of https://github.com/k3s-io/k3s
![]() Automatic merge from submit-queue Avoid double decoding all client responses Fixes #35982 The linked issue uncovered that we were always double decoding the response in restclient for get, list, update, create, and patch. That's fairly expensive, most especially for list. This PR refines the behavior of the rest client to avoid double decoding, and does so while minimizing the changes to rest client consumers. restclient must be able to deal with multiple types of servers. Alter the behavior of restclient.Result#Raw() to not process the body on error, but instead to return the generic error (which still matches the error checking cases in api/error like IsBadRequest). If the caller uses .Error(), .Into(), or .Get(), try decoding the body as a Status. For older servers, continue to default apiVersion "v1" when calling restclient.Result#Error(). This was only for 1.1 servers and the extensions group, which we have since fixed. This removes a double decode of very large objects (like LIST) - we were trying to DecodeInto status, but that ends up decoding the entire result and then throwing it away. This makes the decode behavior specific to the type of action the user wants. ```release-note The error handling behavior of `pkg/client/restclient.Result` has changed. Calls to `Result.Raw()` will no longer parse the body, although they will still return errors that react to `pkg/api/errors.Is*()` as in previous releases. Callers of `Get()` and `Into()` will continue to receive errors that are parsed from the body if the kind and apiVersion of the body match the `Status` object. This more closely aligns rest client as a generic RESTful client, while preserving the special Kube API extended error handling for the `Get` and `Into` methods (which most Kube clients use). ``` |
||
---|---|---|
.. | ||
admission | ||
api | ||
apimachinery | ||
apis | ||
apiserver | ||
auth | ||
capabilities | ||
client | ||
cloudprovider | ||
controller | ||
conversion | ||
credentialprovider | ||
dns | ||
fieldpath | ||
fields | ||
generated | ||
genericapiserver | ||
healthz | ||
httplog | ||
hyperkube | ||
kubectl | ||
kubelet | ||
kubemark | ||
labels | ||
master | ||
metrics | ||
probe | ||
proxy | ||
quota | ||
registry | ||
routes | ||
runtime | ||
security | ||
securitycontext | ||
selection | ||
serviceaccount | ||
ssh | ||
storage | ||
types | ||
util | ||
version | ||
volume | ||
watch | ||
OWNERS |