diff --git a/controllers/cmd/start.go b/controllers/cmd/start.go index fc699dfc73..3b74fcb2d4 100644 --- a/controllers/cmd/start.go +++ b/controllers/cmd/start.go @@ -34,11 +34,16 @@ const ( func Start(namespaced bool, managedNamespace string) { logger := logging.NewArgoEventsLogger().Named(eventbus.ControllerName) config, err := controllers.LoadConfig(func(err error) { - logger.Errorf("Failed to reload global configuration file", zap.Error(err)) + logger.Errorw("Failed to reload global configuration file", zap.Error(err)) }) if err != nil { logger.Fatalw("Failed to load global configuration file", zap.Error(err)) } + + if err = controllers.ValidateConfig(config); err != nil { + logger.Fatalw("Global configuration file validation failed", zap.Error(err)) + } + imageName, defined := os.LookupEnv(imageEnvVar) if !defined { logger.Fatalf("required environment variable '%s' not defined", imageEnvVar) diff --git a/controllers/config.go b/controllers/config.go index b31dfe9b6e..c64365ea1b 100644 --- a/controllers/config.go +++ b/controllers/config.go @@ -116,3 +116,15 @@ func LoadConfig(onErrorReloading func(error)) (*GlobalConfig, error) { }) return r, nil } + +func ValidateConfig(config *GlobalConfig) error { + if len(config.supportedJetStreamVersions()) == 0 { + return fmt.Errorf("no jetstream versions were provided in the controller config") + } + + if len(config.supportedSTANVersions()) == 0 { + return fmt.Errorf("no stan versions were provided in the controller config") + } + + return nil +}