--events controls CRD informer creation

mgruener suggested that the --events flag could be wired to control whether or
not the CRD source created and started its informer.  This commit makes that
change; good idea!
This commit is contained in:
Eric R. Rath 2023-02-27 12:34:16 -08:00
parent 56a8d60fff
commit 929e618935
2 changed files with 3 additions and 2 deletions

View File

@ -133,6 +133,7 @@ func main() {
RequestTimeout: cfg.RequestTimeout, RequestTimeout: cfg.RequestTimeout,
DefaultTargets: cfg.DefaultTargets, DefaultTargets: cfg.DefaultTargets,
OCPRouterName: cfg.OCPRouterName, OCPRouterName: cfg.OCPRouterName,
UpdateEvents: cfg.UpdateEvents,
} }
// Lookup all the selected sources by names and pass them the desired configuration. // Lookup all the selected sources by names and pass them the desired configuration.

View File

@ -69,6 +69,7 @@ type Config struct {
RequestTimeout time.Duration RequestTimeout time.Duration
DefaultTargets []string DefaultTargets []string
OCPRouterName string OCPRouterName string
UpdateEvents bool
} }
// ClientGenerator provides clients // ClientGenerator provides clients
@ -270,8 +271,7 @@ func BuildWithConfig(ctx context.Context, source string, p ClientGenerator, cfg
if err != nil { if err != nil {
return nil, err return nil, err
} }
startInformer := true return NewCRDSource(crdClient, cfg.Namespace, cfg.CRDSourceKind, cfg.AnnotationFilter, cfg.LabelFilter, scheme, cfg.UpdateEvents)
return NewCRDSource(crdClient, cfg.Namespace, cfg.CRDSourceKind, cfg.AnnotationFilter, cfg.LabelFilter, scheme, startInformer)
case "skipper-routegroup": case "skipper-routegroup":
apiServerURL := cfg.APIServerURL apiServerURL := cfg.APIServerURL
tokenPath := "" tokenPath := ""