mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-29 08:26:24 +00:00
This adds a generic implementation of a clientset, and uses it to replace the template code in generated 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. Clientsets with no extensions are reduced to their main getter, their interface, their specific struct, and their constructor. All method implementations are provided by the generic implementation. The dedicated interface is preserved so that each clientset can have its own set of methods, and the dedicated struct is preserved to allow extensions and expansions to be defined where necessary. Instead of handling the variants (with/without namespace, list, apply) with a complex sequence of if statements, build up an index into an array containing the various declarations. The namespaced/non-namespaced distinction matters in the code templates, but not in the methods themselves, so drop all the non-namespaced variants and pass in "" explicitly. Signed-off-by: Stephen Kitt <skitt@redhat.com> Kubernetes-commit: 3734f5bf9b6ce1e9cf2385f4e4453b32d8f35ab1