type Config … type ShouldResyncFunc … type ProcessFunc … type controller … type Controller … // New makes a new Controller from the given Config. func New(c *Config) Controller { … } // Run begins processing items, and will continue until a value is sent down stopCh or it is closed. // It's an error to call Run more than once. // Run blocks; call via go. func (c *controller) Run(stopCh <-chan struct{ … } // Returns true once this controller has completed an initial resource listing func (c *controller) HasSynced() bool { … } func (c *controller) LastSyncResourceVersion() string { … } // processLoop drains the work queue. // TODO: Consider doing the processing in parallel. This will require a little thought // to make sure that we don't end up processing the same object multiple times // concurrently. // // TODO: Plumb through the stopCh here (and down to the queue) so that this can // actually exit when the controller is stopped. Or just give up on this stuff // ever being stoppable. Converting this whole package to use Context would // also be helpful. func (c *controller) processLoop() { … } type ResourceEventHandler … type ResourceEventHandlerFuncs … // OnAdd calls AddFunc if it's not nil. func (r ResourceEventHandlerFuncs) OnAdd(obj interface{ … } // OnUpdate calls UpdateFunc if it's not nil. func (r ResourceEventHandlerFuncs) OnUpdate(oldObj, newObj interface{ … } // OnDelete calls DeleteFunc if it's not nil. func (r ResourceEventHandlerFuncs) OnDelete(obj interface{ … } type ResourceEventHandlerDetailedFuncs … // OnAdd calls AddFunc if it's not nil. func (r ResourceEventHandlerDetailedFuncs) OnAdd(obj interface{ … } // OnUpdate calls UpdateFunc if it's not nil. func (r ResourceEventHandlerDetailedFuncs) OnUpdate(oldObj, newObj interface{ … } // OnDelete calls DeleteFunc if it's not nil. func (r ResourceEventHandlerDetailedFuncs) OnDelete(obj interface{ … } type FilteringResourceEventHandler … // OnAdd calls the nested handler only if the filter succeeds func (r FilteringResourceEventHandler) OnAdd(obj interface{ … } // OnUpdate ensures the proper handler is called depending on whether the filter matches func (r FilteringResourceEventHandler) OnUpdate(oldObj, newObj interface{ … } // OnDelete calls the nested handler only if the filter succeeds func (r FilteringResourceEventHandler) OnDelete(obj interface{ … } // DeletionHandlingMetaNamespaceKeyFunc checks for // DeletedFinalStateUnknown objects before calling // MetaNamespaceKeyFunc. func DeletionHandlingMetaNamespaceKeyFunc(obj interface{ … } // DeletionHandlingObjectToName checks for // DeletedFinalStateUnknown objects before calling // ObjectToName. func DeletionHandlingObjectToName(obj interface{ … } type InformerOptions … // NewInformerWithOptions returns a Store and a controller for populating the store // while also providing event notifications. You should only used the returned // Store for Get/List operations; Add/Modify/Deletes will cause the event // notifications to be faulty. func NewInformerWithOptions(options InformerOptions) (Store, Controller) { … } // NewInformer returns a Store and a controller for populating the store // while also providing event notifications. You should only used the returned // Store for Get/List operations; Add/Modify/Deletes will cause the event // notifications to be faulty. // // Parameters: // - lw is list and watch functions for the source of the resource you want to // be informed of. // - objType is an object of the type that you expect to receive. // - resyncPeriod: if non-zero, will re-list this often (you will get OnUpdate // calls, even if nothing changed). Otherwise, re-list will be delayed as // long as possible (until the upstream source closes the watch or times out, // or you stop the controller). // - h is the object you want notifications sent to. // // Deprecated: Use NewInformerWithOptions instead. func NewInformer( lw ListerWatcher, objType runtime.Object, resyncPeriod time.Duration, h ResourceEventHandler, ) (Store, Controller) { … } // NewIndexerInformer returns an Indexer and a Controller for populating the index // while also providing event notifications. You should only used the returned // Index for Get/List operations; Add/Modify/Deletes will cause the event // notifications to be faulty. // // Parameters: // - lw is list and watch functions for the source of the resource you want to // be informed of. // - objType is an object of the type that you expect to receive. // - resyncPeriod: if non-zero, will re-list this often (you will get OnUpdate // calls, even if nothing changed). Otherwise, re-list will be delayed as // long as possible (until the upstream source closes the watch or times out, // or you stop the controller). // - h is the object you want notifications sent to. // - indexers is the indexer for the received object type. // // Deprecated: Use NewInformerWithOptions instead. func NewIndexerInformer( lw ListerWatcher, objType runtime.Object, resyncPeriod time.Duration, h ResourceEventHandler, indexers Indexers, ) (Indexer, Controller) { … } // NewTransformingInformer returns a Store and a controller for populating // the store while also providing event notifications. You should only used // the returned Store for Get/List operations; Add/Modify/Deletes will cause // the event notifications to be faulty. // The given transform function will be called on all objects before they will // put into the Store and corresponding Add/Modify/Delete handlers will // be invoked for them. // // Deprecated: Use NewInformerWithOptions instead. func NewTransformingInformer( lw ListerWatcher, objType runtime.Object, resyncPeriod time.Duration, h ResourceEventHandler, transformer TransformFunc, ) (Store, Controller) { … } // NewTransformingIndexerInformer returns an Indexer and a controller for // populating the index while also providing event notifications. You should // only used the returned Index for Get/List operations; Add/Modify/Deletes // will cause the event notifications to be faulty. // The given transform function will be called on all objects before they will // be put into the Index and corresponding Add/Modify/Delete handlers will // be invoked for them. // // Deprecated: Use NewInformerWithOptions instead. func NewTransformingIndexerInformer( lw ListerWatcher, objType runtime.Object, resyncPeriod time.Duration, h ResourceEventHandler, indexers Indexers, transformer TransformFunc, ) (Indexer, Controller) { … } // Multiplexes updates in the form of a list of Deltas into a Store, and informs // a given handler of events OnUpdate, OnAdd, OnDelete func processDeltas( // Object which receives event notifications from the given deltas handler ResourceEventHandler, clientState Store, deltas Deltas, isInInitialList bool, ) error { … } // newInformer returns a controller for populating the store while also // providing event notifications. // // Parameters // - clientState is the store you want to populate // - options contain the options to configure the controller func newInformer(clientState Store, options InformerOptions) Controller { … }