@@ -23,14 +23,12 @@ import (
23
23
"strings"
24
24
25
25
"github.com/operator-framework/helm-operator-plugins/internal/flags"
26
- watches "github.com/operator-framework/helm-operator-plugins/internal/legacy/watches"
27
26
"github.com/operator-framework/helm-operator-plugins/internal/metrics"
28
27
"github.com/operator-framework/helm-operator-plugins/internal/version"
29
28
"github.com/operator-framework/helm-operator-plugins/pkg/annotation"
30
29
helmmgr "github.com/operator-framework/helm-operator-plugins/pkg/manager"
31
30
"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"
34
32
35
33
"github.com/spf13/cobra"
36
34
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -179,18 +177,11 @@ func run(cmd *cobra.Command, f *flags.Flags) {
179
177
180
178
for _ , w := range ws {
181
179
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
-
189
180
r , err := reconciler .New (
190
- reconciler .WithChart (* cl ),
181
+ reconciler .WithChart (* w . Chart ),
191
182
reconciler .WithGroupVersionKind (w .GroupVersionKind ),
192
183
reconciler .WithOverrideValues (w .OverrideValues ),
193
- reconciler .WithSelector (w .Selector ),
184
+ reconciler .WithSelector (* w .Selector ),
194
185
reconciler .SkipDependentWatches (* w .WatchDependentResources ),
195
186
reconciler .WithMaxConcurrentReconciles (f .MaxConcurrentReconciles ),
196
187
reconciler .WithReconcilePeriod (f .ReconcilePeriod ),
@@ -207,7 +198,7 @@ func run(cmd *cobra.Command, f *flags.Flags) {
207
198
log .Error (err , "unable to create controller" , "Helm" )
208
199
os .Exit (1 )
209
200
}
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 )
211
202
}
212
203
213
204
log .Info ("starting manager" )
@@ -239,13 +230,3 @@ func exitIfUnsupported(options manager.Options) {
239
230
os .Exit (1 )
240
231
}
241
232
}
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