diff --git a/injection/sharedmain/main.go b/injection/sharedmain/main.go index e5ea14698..0fceb6983 100644 --- a/injection/sharedmain/main.go +++ b/injection/sharedmain/main.go @@ -225,7 +225,16 @@ func MainWithConfig(ctx context.Context, component string, cfg *rest.Config, cto cfg.Burst = len(ctors) * rest.DefaultBurst } - ctx = EnableInjectionOrDie(ctx, cfg) + // Respect user provided settings, but if omitted customize the default behavior. + if cfg.QPS == 0 { + cfg.QPS = rest.DefaultQPS + } + if cfg.Burst == 0 { + cfg.Burst = rest.DefaultBurst + } + ctx = injection.WithConfig(ctx, cfg) + + ctx, informers := injection.Default.SetupInformers(ctx, cfg) logger, atomicLevel := SetupLoggerOrDie(ctx, component) defer flush(logger) @@ -278,7 +287,11 @@ func MainWithConfig(ctx context.Context, component string, cfg *rest.Config, cto return wh.Run(ctx.Done()) }) } - + // Start the injection clients and informers. + logging.FromContext(ctx).Info("Starting informers...") + if err := controller.StartInformers(ctx.Done(), informers...); err != nil { + logging.FromContext(ctx).Fatalw("Failed to start informers", zap.Error(err)) + } // Wait for webhook informers to sync. if wh != nil { wh.InformersHaveSynced()