Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartControllers ¶
func StartControllers(controllers ...Controller) (err error)
StartControllers starts one or multiple controllers. If initial sync is required, use StartControllersWithInitialSync
func StartControllersWithInitialSync ¶
func StartControllersWithInitialSync(initialSync func() error, controllers ...Controller) (err error)
StartControllersWithInitialSync starts one or multiple controllers that share initialSync function. initialSync will be called after all event handlers for given controllers were added, but before queue handlers are started. It ensures no events will be missed. A user of this package that manages multiple controllers would most likely do a single call to this function if it needs to use this sync to take an initial action (i.e. building up its own cache) correlating the information from all the initialized informers. If initial sync is not required, use StartControllers.
func StopControllers ¶
func StopControllers(controllers ...Controller)
Types ¶
type Config ¶
type Config[T any] struct { RateLimiter workqueue.RateLimiter Informer cache.SharedIndexInformer Lister func(selector labels.Selector) (ret []*T, err error) // ObjNeedsUpdate tells if object should be reconciled. // May be called with oldObj = nil on Add, won't be called on Delete. ObjNeedsUpdate func(oldObj, newObj *T) bool Reconcile func(key string) error // How many workers should be started for this controller. Threadiness int }
type Controller ¶
type Controller interface { ReconcileAll() // contains filtered or unexported methods }
Controller is a level-driven controller that is shut down after Stop() call.
func NewController ¶
func NewController[T any](name string, config *Config[T]) Controller
NewController creates a new level-driven controller. It should be started and stopped using StartControllers and StopControllers functions.