From 8b80e8f613bf122302997e2dbc1cd34809423eb2 Mon Sep 17 00:00:00 2001 From: yangquan1 Date: Tue, 4 Jul 2023 20:46:53 +0800 Subject: [PATCH] fix recommendation feature gates --- cmd/craned/app/manager.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/craned/app/manager.go b/cmd/craned/app/manager.go index 0ae0e7db2..57dfac9ef 100644 --- a/cmd/craned/app/manager.go +++ b/cmd/craned/app/manager.go @@ -143,8 +143,7 @@ func Run(ctx context.Context, opts *options.Options) error { } }() - recommenderMgr := initRecommenderManager(opts) - initControllers(podOOMRecorder, mgr, opts, predictorMgr, recommenderMgr, historyDataSources[providers.PrometheusDataSource]) + initControllers(podOOMRecorder, mgr, opts, predictorMgr, historyDataSources[providers.PrometheusDataSource]) // initialize custom collector metrics initMetricCollector(mgr) runAll(ctx, mgr, predictorMgr, dataSourceProviders[providers.PrometheusDataSource], opts) @@ -267,7 +266,7 @@ func initPredictorManager(opts *options.Options, realtimeDataSources map[provide } // initControllers setup controllers with manager -func initControllers(oomRecorder oom.Recorder, mgr ctrl.Manager, opts *options.Options, predictorMgr predictor.Manager, recommenderMgr recommendation.RecommenderManager, historyDataSource providers.History) { +func initControllers(oomRecorder oom.Recorder, mgr ctrl.Manager, opts *options.Options, predictorMgr predictor.Manager, historyDataSource providers.History) { discoveryClientSet, err := discovery.NewDiscoveryClientForConfig(mgr.GetConfig()) if err != nil { klog.Exit(err, "Unable to create discover client") @@ -367,6 +366,8 @@ func initControllers(oomRecorder oom.Recorder, mgr ctrl.Manager, opts *options.O // TODO(qmhu), change feature gate from analysis to recommendation if utilfeature.DefaultFeatureGate.Enabled(features.CraneAnalysis) { + recommenderMgr := initRecommenderManager(opts) + if err := (&analytics.Controller{ Client: mgr.GetClient(), /*Scheme: mgr.GetScheme(),