diff --git a/common/leaderelection/leaderelection.go b/common/leaderelection/leaderelection.go index eb2d8d6180..7ea6214b92 100644 --- a/common/leaderelection/leaderelection.go +++ b/common/leaderelection/leaderelection.go @@ -58,11 +58,8 @@ func NewEventBusElector(ctx context.Context, eventBusConfig eventbusv1alpha1.Bus } v.WatchConfig() v.OnConfigChange(func(e fsnotify.Event) { - logger.Info("eventbus auth config file changed.") - err = v.Unmarshal(cred) - if err != nil { - logger.Errorw("failed to unmarshal auth.yaml after reloading", zap.Error(err)) - } + // Auth file changed, let it restart. + logger.Fatal("Eventbus auth config file changed, exiting..") }) auth = &eventbusdriver.Auth{ Strategy: *eventBusAuth, @@ -95,6 +92,8 @@ func (e *natsEventBusElector) RunOrDie(ctx context.Context, callbacks LeaderCall log := logging.FromContext(ctx) ci := graft.ClusterInfo{Name: e.clusterName, Size: e.size} opts := &nats.DefaultOptions + // Will never give up + opts.MaxReconnect = -1 opts.Url = e.url if e.auth.Strategy == eventbusv1alpha1.AuthStrategyToken { opts.Token = e.auth.Crendential.Token diff --git a/eventbus/eventbus.go b/eventbus/eventbus.go index 8518df230e..8170a19339 100644 --- a/eventbus/eventbus.go +++ b/eventbus/eventbus.go @@ -48,11 +48,8 @@ func GetDriver(ctx context.Context, eventBusConfig eventbusv1alpha1.BusConfig, s } v.WatchConfig() v.OnConfigChange(func(e fsnotify.Event) { - logger.Info("eventbus auth config file changed.") - err = v.Unmarshal(cred) - if err != nil { - logger.Errorw("failed to unmarshal auth.yaml after reloading", zap.Error(err)) - } + // Auth file changed, let it restart + logger.Fatal("Eventbus auth config file changed, exiting..") }) auth = &driver.Auth{ Strategy: *eventBusAuth,