@@ -23,14 +23,12 @@ import (
2323 "strings"
2424
2525 "github.com/operator-framework/helm-operator-plugins/internal/flags"
26- watches "github.com/operator-framework/helm-operator-plugins/internal/legacy/watches"
2726 "github.com/operator-framework/helm-operator-plugins/internal/metrics"
2827 "github.com/operator-framework/helm-operator-plugins/internal/version"
2928 "github.com/operator-framework/helm-operator-plugins/pkg/annotation"
3029 helmmgr "github.com/operator-framework/helm-operator-plugins/pkg/manager"
3130 "github.com/operator-framework/helm-operator-plugins/pkg/reconciler"
32- "helm.sh/helm/v3/pkg/chart"
33- "helm.sh/helm/v3/pkg/chart/loader"
31+ "github.com/operator-framework/helm-operator-plugins/pkg/watches"
3432
3533 "github.com/spf13/cobra"
3634 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -179,18 +177,11 @@ func run(cmd *cobra.Command, f *flags.Flags) {
179177
180178 for _ , w := range ws {
181179
182- // TODO: remove this after modifying watches of hybrid lib.
183- cl , err := getChart (w )
184- if err != nil {
185- log .Error (err , "Unable to read chart" )
186- os .Exit (1 )
187- }
188-
189180 r , err := reconciler .New (
190- reconciler .WithChart (* cl ),
181+ reconciler .WithChart (* w . Chart ),
191182 reconciler .WithGroupVersionKind (w .GroupVersionKind ),
192183 reconciler .WithOverrideValues (w .OverrideValues ),
193- reconciler .WithSelector (w .Selector ),
184+ reconciler .WithSelector (* w .Selector ),
194185 reconciler .SkipDependentWatches (* w .WatchDependentResources ),
195186 reconciler .WithMaxConcurrentReconciles (f .MaxConcurrentReconciles ),
196187 reconciler .WithReconcilePeriod (f .ReconcilePeriod ),
@@ -207,7 +198,7 @@ func run(cmd *cobra.Command, f *flags.Flags) {
207198 log .Error (err , "unable to create controller" , "Helm" )
208199 os .Exit (1 )
209200 }
210- log .Info ("configured watch" , "gvk" , w .GroupVersionKind , "chartDir" , w .ChartDir , "maxConcurrentReconciles" , f .MaxConcurrentReconciles , "reconcilePeriod" , f .ReconcilePeriod )
201+ log .Info ("configured watch" , "gvk" , w .GroupVersionKind , "chartDir" , w .ChartPath , "maxConcurrentReconciles" , f .MaxConcurrentReconciles , "reconcilePeriod" , f .ReconcilePeriod )
211202 }
212203
213204 log .Info ("starting manager" )
@@ -239,13 +230,3 @@ func exitIfUnsupported(options manager.Options) {
239230 os .Exit (1 )
240231 }
241232}
242-
243- // getChart returns the chart from the chartDir passed to the watches file.
244- func getChart (w watches.Watch ) (* chart.Chart , error ) {
245- c , err := loader .LoadDir (w .ChartDir )
246- if err != nil {
247- return nil , fmt .Errorf ("failed to load chart dir: %w" , err )
248- }
249-
250- return c , nil
251- }
0 commit comments