Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // RestConfig the REST config used to access the resources to watch. RestConfig *rest.Config // RestMapper used to obtain GroupVersionResources. This is optional and is provided for unit testing in lieu of the // RestConfig. If not specified, one is created from the RestConfig. RestMapper meta.RESTMapper // Client the client used to access the resources to watch. This is optional and is provided for unit testing in lieu // of the RestConfig. If not specified, one is created from the RestConfig. Client dynamic.Interface // WaitForCacheSync if true, waits for the informer cache to sync on Start. Default is true. WaitForCacheSync *bool // Scheme used to convert resource objects. By default the global k8s Scheme is used. Scheme *runtime.Scheme // ResyncPeriod if non-zero, the period at which resources will be re-synced regardless if anything changed. Default is 0. ResyncPeriod time.Duration // ResourceConfigs the configurations for the resources to watch. ResourceConfigs []ResourceConfig }
type EventHandler ¶
type EventHandler interface { OnCreate(obj runtime.Object) bool OnUpdate(obj runtime.Object) bool OnDelete(obj runtime.Object) bool }
EventHandler can handle notifications of events that happen to a resource. The bool return value from each event notification method indicates whether or not the resource should be re-queued to be retried later, typically in case of an error.
type EventHandlerFuncs ¶
type EventHandlerFuncs struct { OnCreateFunc func(obj runtime.Object) bool OnUpdateFunc func(obj runtime.Object) bool OnDeleteFunc func(obj runtime.Object) bool }
EventHandlerFuncs is an adaptor to let you easily specify as many or as few of the notification functions as you want while still implementing EventHandler.
type ResourceConfig ¶
type ResourceConfig struct { // Name of this watcher used for logging. Name string // ResourceType the types of the resources to watch. ResourceType runtime.Object // Handler that is notified of create, update, and delete events. Handler EventHandler // ResourcesEquivalent function to compare two resources for equivalence. This is invoked on an update notification // to compare the old and new resources. If true is returned, the update is ignored, otherwise the update is processed. // By default all updates are processed. ResourcesEquivalent syncer.ResourceEquivalenceFunc // SourceNamespace the namespace of the resources to watch. SourceNamespace string // SourceLabelSelector optional selector to restrict the resources to watch by their labels. SourceLabelSelector string // SourceFieldSelector optional selector to restrict the resources to watch by their fields. SourceFieldSelector string }
Click to show internal directories.
Click to hide internal directories.