Use client.Object instead of concrete resource types in Helm Query interface
This MR removes typed functions of Helm Query interface and replaces them with generic functions that take resource type as a parameter and return client.Object. References to Helm Query interface are also updated/refactored to work with client.Object. When a type-specific operation is needed an explicit type assertion is used to safely convert the client.Object to the type that is required.
All type-specific query function, i.e. XyzBy{Name,Labels,Component}, are removed from helm.Query and replaced with:
- ObjectsByKind
- ObjectByKindAndName
- ObjectsByKindAndLabels
- ObjectByKindAndComponent
These functions use client.Object instead of runtime.Object.
Query wrapper functions in controllers/gitlab are refactored to work with client.Object instead of specific resource types. In the majority of cases, the generic resource works as expected. For type-specific operations, helper functions are added to controllers/internal/helpers.go to safely convert client.Object to the expected resource type.
To ensure that refactoring does not break the existing functionality a series of dynamically generated test cases are added to controllers/refactor_test.go. These tests can be safely removed after merging this MR.
Closes #432 (closed)