-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/upgrade: abstract resource deletion with Unstructured
For the coming requirement to remove resources not just by their names but a field inside of spec, abstract the existing deleteDeprecatedResources/deleteDeprecatedServiceMonitors to take a resource to delete description as ``` type JobSpec struct { Gvk schema.GroupVersionKind Namespace string Path []string Values []string } ``` and convert existing calls to used it. The function fetches UnstructuredList by gvk/namespace and uses public unstructured.NestedString() to access the field by path. It should work for ServiceMonitor, where ServiceMonitorList contains list of the pointers, as well. Ignore NoKindMatchError. CRD may not exist on fresh installation for example. Make a wrapper which takes an array of them for convenience and avoid one indentation level and simplifies multierror wrapping a bit. It requires to have a library of GroupVersionKinds which is a future work to make common for the whole project. Move OdhApplication and OdhDashboardConfig to the gvk list, it's proper place now. Signed-off-by: Yauheni Kaliuta <[email protected]>
- Loading branch information
Showing
1 changed file
with
141 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters