Commit Graph

14 Commits

Author SHA1 Message Date
jlsong01
470c93d04c allocate a unique scheme for each test to fix concurrent usage issue
Kubernetes-commit: d66b3edd65efba0760eb0a5668aac733f294903b
2022-01-31 15:23:42 +08:00
John Howard
f582d43dbd Make metadata fake client implement testing.FakeClient
This mirrors most (maybe all?) other fake clients. Example of a real
world use case this would have been useful:
https://github.com/istio/istio/pull/35434

Kubernetes-commit: 86c9fef160b37ce834b680e49cf237917d2e5c6c
2021-09-30 16:32:23 -07:00
Antonio Ojea
30025c3fbc expose NewForConfigAndClient for the metadata client
Kubernetes-commit: 909a1738fdf7b33513a1409860289a3d38d77267
2021-10-19 16:00:53 +02:00
scott
0c4682e956 explain the reason why metaclient special processing metav1.DeleteOptions encoding
metaclient explicitly specifies the Content-Type when executing Delete and DeleteCollection, and add test for that

Kubernetes-commit: 8976f6f6d9af22ad40df891565c19e4dfd67f591
2021-08-25 17:55:25 +08:00
Martin Schimandl
3450a048bc Fix staticchecks in vendor/k8s.io/client-go
Kubernetes-commit: 13c017056c924e148113e42786a511ed2fee7594
2020-10-01 12:40:32 +02:00
Davanum Srinivas
75fea27a27 switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 442a69c3bdf6fe8e525b05887e57d89db1e2f3a5
2020-04-17 15:25:06 -04:00
Quan Tian
faf5681d1c Improve fake clientset performance
The fake clientset used a slice to store each kind of objects, it's
quite slow to init the clientset with massive objects because it checked
existence of an object by traversing all objects before adding it, which
leads to O(n^2) time complexity. Also, the Create, Update, Get, Delete
methods needs to traverse all objects, which affects the time statistic
of code that calls them.

This patch changed to use a map to store each kind of objects, reduced
the time complexity of initializing clientset to O(n) and the Create,
Update, Get, Delete to O(1).

For example:
Before this patch, it took ~29s to init a clientset with 30000 Pods,
and 2~4ms to create and get an Pod.
After this patch, it took ~50ms to init a clientset with 30000 Pods,
and tens of µs to create and get an Pod.

Kubernetes-commit: 7e15e31e11e48a6db855e30ca9b07dbce3047577
2020-03-27 18:39:20 +08:00
Jordan Liggitt
5883a775b1 client-go metadata: plumb context
Kubernetes-commit: cb4ee9334b744404e670ea2c28a3093a3cd67844
2020-03-06 10:42:18 -05:00
Mike Danese
b136e9eb2b refactor
Kubernetes-commit: d55d6175f8e2cfdab0b79aac72046a652c2eb515
2020-01-27 18:19:44 -08:00
Clayton Coleman
9bbcc2938d Always negotiate a decoder using ClientNegotiator
This commit performs two refactors and fixes a bug.

Refactor 1 changes the signature of Request to take a RESTClient, which
removes the extra copy of everything on RESTClient from Request. A pair
of optional constructors are added for testing. The major functional
change is that Request no longer has the shim HTTPClient interface and
so some test cases change slightly because we are now going through
http.Client code paths instead of direct to our test stubs.

Refactor 2 changes the signature of RESTClient to take a
ClientContentConfig instead of ContentConfig - the primary difference
being that ClientContentConfig uses ClientNegotiator instead of
NegotiatedSerializer and the old Serializers type. We also collapse
some redundancies (like the rate limiter can be created outside the
constructor).

The bug fix is to negotiate the streaming content type on a Watch()
like we do for requests. We stop caching the decoder and simply
resolve it on the request. We also clean up the dynamic client
and remove the extra WatchSpecificVersions() method by providing
a properly wrapped dynamic client.

Kubernetes-commit: 3b780c64b89606f4e6b21f48fb9c305d5998b9e5
2019-11-10 16:52:08 -05:00
wojtekt
aebe267284 Ensure conversions are registered for metainternalversion codecs
Kubernetes-commit: 54163527a69a8c868b87d301876559495220d1b0
2019-09-11 16:30:08 +02:00
Clayton Coleman
0f7aa3096b Rename metadata.NewConfigOrDie to be consistent
Updated name to match dynamic client

Kubernetes-commit: 98d87a4f03e22bb8e4d22460855913d23930685a
2019-07-10 18:35:45 -04:00
Clayton Coleman
cade5c0473 Add fake client, informer factory, and lister to metadata client
These will be used by the garbage collector controller and others that
use higher level primitives.

Kubernetes-commit: bc89c37f32aa6cfd0f9ca975d9221d0a89320623
2019-06-05 14:28:51 -04:00
Clayton Coleman
0eaec69666 Add a metadata client to client-go that can read PartialObjectMetadata
This client exposes operations on generic metadata (get, list, watch, delete)
and allows patch operations. The client always uses protobuf and requests
the server transform the response into the appropriate object. Using this
client simplifies the work of generic controllers by allowing them to treat
all objects the same, and also improves performance both in the amount of
data sent as well as allowing protobuf on CRD resources.

Kubernetes-commit: 21f5e643d9dbe6b65d21713dc16ab8888de5423e
2019-04-02 15:45:07 -04:00