Commit Graph

14 Commits

Author SHA1 Message Date
Jordan Liggitt
5be379c517 Drop null creationTimestamp from test fixtures
Kubernetes-commit: 6bb6c9934294d8265197c9dfc4c9dd3adaca147a
2025-03-24 09:37:26 -04:00
Tim Hockin
c4339eeca9 Replace uses of ObjectGoPrintDiff with cmp.Diff
ObjectGoPrintDiff is already a shim over cmp.Diff, so no actual output
or behavior changes

Kubernetes-commit: 9627c50ef37f3b5274486e6f5ad37b73b1b69bf0
2023-03-23 11:31:25 -07:00
Harsimran Singh Maan
0c269b7a5b remove selflink as per review feedback
Kubernetes-commit: 5da368d012f7635f9718876061bec864b7dcf8e6
2022-10-17 09:19:21 -07:00
Harsimran Singh Maan
fbd8e9aa52 fix failing test assertions
Kubernetes-commit: c8714ebd118760f8d68e9b536d0350129af12d9b
2022-02-22 16:05:40 -08:00
Harsimran Singh Maan
1f10368e31 Preserve metadata for fake dynamic client unstructured lists
Signed-off-by: Harsimran Singh Maan <maan.harry@gmail.com>

Kubernetes-commit: ac904454c24bebd9501ea4701d38f55f25ec9c33
2021-12-31 15:15:18 -08:00
dprotaso
c6c0ca0e1e Simplify use of the fake dynamic client
With the introduction of GVK to the fake dynamic client it made using
the fake much more cumbersome.

Specifically:
- requires manual registration of list types
- mismatch between scheme types and passed in fixtures would result in errors

The PR changes the constructor method NewSimpleDynamicClient to do the following:
- rewire the schemes to unstructured types
- typed fixtures are converted to unstructured types
- automatically register fixture gvks with the scheme

This should make the dynamic client 'flexible' with it's inputs like it was
before

Kubernetes-commit: 418fa71b6b1d1fba930daaba1f8ecf55070b4bdf
2021-06-16 14:51:00 -04:00
David Eads
20c034c178 add GVK to fake dynamic client to match actual behavior
Kubernetes-commit: f4383458432cd67714e9ce0acde56a2ed5c24a21
2020-10-29 15:53:34 -04:00
Andrew Sy Kim
1db2969ba9 fake dynamic client: support *List kinds
Today the dynamic fake client is not aware of *List kinds, so List calls return UnstructuredList
objects without TypeMeta. This patch updates client-go's fake object tracker to store a map of
GVR to list GVKs. In this way, the list GVK can be set for UnstructuredList objects.

Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>

Kubernetes-commit: 0845b863e89912e0d6c4380f8bc362646326386a
2020-10-27 23:08:46 -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
1faf9e8d03 client-go dynamic context
Kubernetes-commit: 6fa54d715fbc992afb483e71d450d5dbd66990eb
2020-03-06 01:27:11 -05:00
Steve Kriss
f0c6576981 client-fake object tracker: support merge patch
Signed-off-by: Steve Kriss <krisss@vmware.com>

Kubernetes-commit: d425fe29bd808db54c59e3e0ecdedbe735b8f68b
2019-02-21 13:47:16 -07:00
Antoine Pelisse
35efedd302 API Machinery, Kubectl and tests
Kubernetes-commit: 0e1d50e70fdc9ed838d75a7a1abbe5fa607d22a1
2019-01-16 21:14:42 -08:00
Ville Aikas
41406bf985 Add support for JSON patch in fake client
Kubernetes-commit: a363b153851326ece7f81f4c1ae0a1ab8700a209
2018-10-02 13:30:52 +00:00
David Eads
4b43750b96 fix dynamic client listing bug
Kubernetes-commit: 60afd0ba81aeccb04169716c815348ceb424730d
2018-07-11 13:05:54 -04:00