Fix: recover application watcher when sharding disabled (#5488)

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
This commit is contained in:
Somefive
2023-02-13 16:57:59 +08:00
committed by GitHub
parent 22cb57d3e7
commit 930ead942e
+7 -7
View File
@@ -201,6 +201,13 @@ func run(ctx context.Context, s *options.CoreOptions) error {
}
}
klog.Info("Start the vela application monitor")
informer, err := mgr.GetCache().GetInformer(ctx, &v1beta1.Application{})
if err != nil {
klog.ErrorS(err, "Unable to get informer for application")
}
watcher.StartApplicationMetricsWatcher(informer)
if err := mgr.Start(ctx); err != nil {
klog.ErrorS(err, "Failed to run manager")
return err
@@ -228,13 +235,6 @@ func prepareRunInShardingMode(ctx context.Context, mgr manager.Manager, s *optio
}
}
klog.Info("Start the vela application monitor")
informer, err := mgr.GetCache().GetInformer(ctx, &v1beta1.Application{})
if err != nil {
klog.ErrorS(err, "Unable to get informer for application")
}
watcher.StartApplicationMetricsWatcher(informer)
return nil
}