Commit Graph

18 Commits

Author SHA1 Message Date
Stephen Kitt
c475fe0910 Generify fake clientsets
This adds a generic implementation of a fake clientset, and uses it to
replace the template code in generated fake clientsets for the default
methods. The templates are preserved as-is (or as close as they can
be) for use in extensions, whether for resources or subresources.

Fake clientsets with no extensions are reduced to their main getter,
their specific struct, and their constructor. All method
implementations are provided by the generic implementation. The
dedicated struct is preserved to allow extensions and expansions to be
defined where necessary.

Instead of handling the variants (with/without list, apply) with a
complex sequence of if statements, build up an index into an array
containing the various declarations.

Similarly, instead of calling different action constructors for
namespaced and non-namespaced clientsets, assume the current behaviour
of non-namespaced action creation (equivalent to creating a namespaced
action with an empty namespace) and document that assumption in the
action implementation.

Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: b0ce65df9b74d4dc72050840d5ad067596d7b822
2024-07-30 15:47:02 +02:00
Joe Betz
96f66e9159 Support options for all client fake actions
Kubernetes-commit: 599f03c72264d5149ae63b1c9eccb33e8b32e900
2024-06-24 15:41:38 -04:00
Chun Chen
d478a5752d Pass DeleteOptions down to the Reactor
Co-authored-by: Mo Khan <theenjeru@gmail.com>

Kubernetes-commit: 621970476f8f06419716325d573580be7b3378d9
2021-06-17 18:06:47 +08:00
Markus Thömmes
1133cbffc1 Allow Action's Matches function to specify a subresource.
In other parts of the system (notably in RBAC rules), the "resource/subresource" notation is common to specify an explicit subresource. This makes this notation available to tests that use the `Matches` function on client actions as well.

Backwards compatibility is kept by ignoring the `Subresource` field if no specific subresource is defined in the resource string itself.

Kubernetes-commit: 47277f281eb0e7d484555e4d210b0ddb42974793
2020-01-30 12:04:23 +01:00
RainbowMango
532b6f676e Cleanup staticcheck issues for package in client-go.
Kubernetes-commit: c8c055b3163dd2661b3f9dd1b0ffb718a61aba24
2019-08-26 20:55:32 +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
77541e5cb7 add subresource support for the dynamic client
Kubernetes-commit: 82e32d2a3260807237a69bc40fb371db640d26fc
2018-05-09 12:52:12 -04:00
Josh Horwitz
64101cbe6a Fixes fake client generation for non-namespaced subresources
Kubernetes-commit: 0f62a8cddac0a48506fc1b93f37da32530fd2358
2018-02-26 14:03:11 -05:00
David Eads
f8d192aa24 deep copy fake client actions to avoid accidental mutation
Kubernetes-commit: 9ef99d189f2e454a293b8c343fee173c876ed21f
2018-03-02 09:19:52 -05:00
Michal Fojtik
bf85a9d89b add missing sub-resources test actions
Kubernetes-commit: c026b62d19d83d4f68235d1bd039a469e87d215d
2017-09-04 13:49:16 +00:00
Lucas Käldström
1bc6d1247e kubeadm: Adds dry-run support for kubeadm using the '--dry-run' option
Kubernetes-commit: 0bf84aa182449ab51cbb5f819da3fbcad19690a2
2017-08-29 12:52:28 +00:00
Chao Xu
85c50f4ccb remove registry from testing/fixture.go; update client-gen to not use
registry in the generated clients

Kubernetes-commit: bbb94e42c108840c540c5667f8da97c33b81d84a
2017-05-04 20:28:29 +00:00
Kubernetes Publisher
687fd42903 published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is 68f123dfa036bef57495f014a78144a9a1b517ca
2017-01-24 15:19:42 +00:00
Kubernetes Publisher
0eb5431cb7 published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is 8d5227bb2e05e01031ace81fa6611a13f598278e
2017-01-21 15:19:42 +00:00
Kubernetes Publisher
204f12b1f3 published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is 616038db1b0d1e852b4a3d10c8c512a052f91fba
2017-01-14 15:19:47 +00:00
Kubernetes Publisher
5d8c36c93c published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is 124fb610dcbd445fa710da67508ac6d5b822f61d
2016-11-24 08:15:51 +00:00
Kubernetes Publisher
75399f68c8 published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is e56cfc5322138aa23e6418ee30a6ab54c7c6fe8c
2016-10-21 04:44:19 +00:00
Chao Xu
a6d206121d remove the top-level folders for versions
remove scripts
2016-10-19 14:34:19 -07:00