feat: be able to import any k8s obj as source#1321
feat: be able to import any k8s obj as source#1321guilhem wants to merge 1 commit intofluxcd:mainfrom
Conversation
f500771 to
4575da1
Compare
This permit any object as source Co-authored-by: Alan Amoyel <aamoyel@users.noreply.github.com> Co-authored-by: bitswalk <bitswalk@users.noreply.github.com> Signed-off-by: Guilhem Lettron <guilhem@barpilot.io>
|
Hi @guilhem, thanks for this PR. This change is far more complex than this PR sounds and must be discussed in the Flux dev meetings, which are open. Feel free to join one of the meetings in the new year if you want to discuss about this change: https://fluxcd.io/community/#meetings |
Thanks @matheuscscp and after some time and reflection, I don't even think it's a good way to do it. In fact, I tried to keep this PR as small as possible, but I think there is a far better way to do: But let's talk about it in a meeting. I can also talk about why we try to have something like that :) |
|
But it was a good way to understand links between objects ;) |
This pull request introduces several significant changes to the
kustomization_controllerto enhance the discovery and handling of source references, as well as adding new tests to ensure functionality. The most important changes include adding aDiscoveryClientto theKustomizationReconciler, refactoring the source retrieval logic, and adding a new test for theSourceRefAPIVersion.Enhancements to
KustomizationReconciler:DiscoveryClientto theKustomizationReconcilerstruct for dynamic API discovery. (internal/controller/kustomization_controller.go)Sourcetype and refactored thegetSourcemethod to useunstructured.Unstructuredfor dynamic API version handling. (internal/controller/kustomization_controller.go)Codebase updates:
discoverypackage in multiple files. (internal/controller/kustomization_controller.go,internal/controller/suite_test.go,main.go) [1] [2] [3]mainfunction to initializeDiscoveryClientand pass it to theKustomizationReconciler. (main.go)Testing improvements:
TestKustomizationReconciler_SourceRefAPIVersionto verify the correct handling ofSourceRefAPI versions. (internal/controller/kustomization_controller_test.go)DiscoveryClient. (internal/controller/suite_test.go)