k3s/pkg
Kubernetes Submit Queue 7d14b568c3 Merge pull request #36001 from smarterclayton/change_double_decode
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).
```
2016-11-02 11:36:41 -07:00
..
admission autogenerated 2016-10-21 17:32:32 -07:00
api Merge pull request #36001 from smarterclayton/change_double_decode 2016-11-02 11:36:41 -07:00
apimachinery autogenerated 2016-10-21 17:32:32 -07:00
apis ExportOptions should be registered to all public schemas 2016-11-01 22:55:58 -04:00
apiserver Merge pull request #35840 from caesarxuchao/hide-new-versions 2016-11-02 04:49:56 -07:00
auth fix tests by declaring testdata 2016-10-21 17:32:32 -07:00
capabilities autogenerated 2016-10-21 17:32:32 -07:00
client Merge pull request #36001 from smarterclayton/change_double_decode 2016-11-02 11:36:41 -07:00
cloudprovider Merge pull request #35066 from justinsb/typo_attachment 2016-11-02 03:07:45 -07:00
controller Merge pull request #35739 from foxish/migrating-the-annotation 2016-11-02 09:58:00 -07:00
conversion autogenerated 2016-10-21 17:32:32 -07:00
credentialprovider Merge pull request #35013 from justinsb/us_east_2 2016-11-01 18:47:07 -07:00
dns autogenerated 2016-10-24 14:47:27 -07:00
fieldpath autogenerated 2016-10-21 17:32:32 -07:00
fields autogenerated 2016-10-21 17:32:32 -07:00
generated Add FeatureGates field to KubeletConfiguration 2016-11-01 14:53:50 -07:00
genericapiserver Merge pull request #35795 from deads2k/api-33-clean-master.go 2016-11-01 06:50:23 -07:00
healthz autogenerated 2016-10-21 17:32:32 -07:00
httplog autogenerated 2016-10-21 17:32:32 -07:00
hyperkube autogenerated 2016-10-21 17:32:32 -07:00
kubectl Merge pull request #30091 from rootfs/azure-storage 2016-11-01 17:27:14 -07:00
kubelet Fix build break on non-Linux OS introduced in 87aaf4c0 2016-11-02 12:27:11 +02:00
kubemark Adding a root filesystem override for kubelet mounter 2016-10-26 21:42:59 -07:00
labels autogenerated 2016-10-21 17:32:32 -07:00
master remove non-reuseable bits of MasterServer 2016-10-31 08:50:05 -04:00
metrics autogenerated 2016-10-24 14:47:27 -07:00
probe autogenerated 2016-10-21 17:32:32 -07:00
proxy Log portal IP in error info. 2016-11-01 05:26:16 -04:00
quota quota controller uses informers if available for pod calculation 2016-10-31 11:38:22 -04:00
registry remove non-reuseable bits of MasterServer 2016-10-31 08:50:05 -04:00
routes autogenerated 2016-10-21 17:32:32 -07:00
runtime Unversioned types should decode no matter what the requested version is 2016-11-01 22:55:59 -04:00
security fix tests by declaring testdata 2016-10-21 17:32:32 -07:00
securitycontext autogenerated 2016-10-21 17:32:32 -07:00
selection autogenerated 2016-10-21 17:32:32 -07:00
serviceaccount autogenerated 2016-10-21 17:32:32 -07:00
ssh Merge pull request #35323 from mikkeloscar/decode-pem 2016-10-27 02:59:29 -07:00
storage Increase etcd3 compaction frequency 2016-10-31 08:40:13 +01:00
types autogenerated 2016-10-21 17:32:32 -07:00
util Add FeatureGates field to KubeletConfiguration 2016-11-01 14:53:50 -07:00
version rename build/ to build-tools/ 2016-10-24 14:41:56 -07:00
volume Merge pull request #30091 from rootfs/azure-storage 2016-11-01 17:27:14 -07:00
watch move watch.ListWatchUntil to its own package to avoid future import cycle 2016-10-30 13:14:20 -07:00
OWNERS