diff --git a/plugin/plugin.go b/plugin/plugin.go index d2231b5b..5d1c7cd8 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -547,6 +547,16 @@ func (m *manager) start() error { return errors.Wrapf(err, "start %s syncer", v.Name()) } } + + // controller starter? + controllerStarter, ok := v.(syncer.ControllerStarter) + if ok { + log.Infof("Start controller %s", v.Name()) + err = controllerStarter.Register(m.context) + if err != nil { + return errors.Wrapf(err, "start %s controller", v.Name()) + } + } } log.Infof("Successfully started plugin.") diff --git a/syncer/types.go b/syncer/types.go index ed273dfa..f36a67c1 100644 --- a/syncer/types.go +++ b/syncer/types.go @@ -130,3 +130,9 @@ type IndicesRegisterer interface { type ControllerModifier interface { ModifyController(ctx *context.RegisterContext, builder *builder.Builder) (*builder.Builder, error) } + +// ControllerStarter is a generic controller that can be used if the syncer abstraction does not fit +// the use case +type ControllerStarter interface { + Register(ctx *context.RegisterContext) error +}