Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Kubernetes-commit: b0ce65df9b74d4dc72050840d5ad067596d7b822
- Loading branch information