Documentation ¶
Index ¶
- func NewFilteringHandlerOnAllEvents(filterFunc func(obj interface{}) bool, addFunc func(obj interface{}), ...) cache.ResourceEventHandler
- func NewHandlerOnAllEvents(fn func(runtime.Object)) cache.ResourceEventHandler
- func NewHandlerOnEvents(addFunc func(obj interface{}), updateFunc func(oldObj, newObj interface{}), ...) cache.ResourceEventHandler
- type MultiClusterInformerManager
- type SingleClusterInformerManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFilteringHandlerOnAllEvents ¶ added in v0.4.0
func NewFilteringHandlerOnAllEvents(filterFunc func(obj interface{}) bool, addFunc func(obj interface{}), updateFunc func(oldObj, newObj interface{}), deleteFunc func(obj interface{})) cache.ResourceEventHandler
NewFilteringHandlerOnAllEvents builds a FilteringResourceEventHandler applies the provided filter to all events coming in, ensuring the appropriate nested handler method is invoked.
Note: An object that starts passing the filter after an update is considered an add, and an object that stops passing the filter after an update is considered a delete. Like the handlers, the filter MUST NOT modify the objects it is given.
func NewHandlerOnAllEvents ¶
func NewHandlerOnAllEvents(fn func(runtime.Object)) cache.ResourceEventHandler
NewHandlerOnAllEvents builds a ResourceEventHandler that the function 'fn' will be called on all events(add/update/delete).
func NewHandlerOnEvents ¶ added in v0.4.0
func NewHandlerOnEvents(addFunc func(obj interface{}), updateFunc func(oldObj, newObj interface{}), deleteFunc func(obj interface{})) cache.ResourceEventHandler
NewHandlerOnEvents builds a ResourceEventHandler.
Types ¶
type MultiClusterInformerManager ¶
type MultiClusterInformerManager interface { // ForCluster builds a informer manager for a specific cluster. ForCluster(cluster string, client dynamic.Interface, defaultResync time.Duration) SingleClusterInformerManager // GetSingleClusterManager gets the informer manager for a specific cluster. // The informer manager should be created before, otherwise, nil will be returned. GetSingleClusterManager(cluster string) SingleClusterInformerManager // IsManagerExist checks if the informer manager for the cluster already created. IsManagerExist(cluster string) bool // Start will run all informers for a specific cluster, it accepts a stop channel, the informers will keep running until channel closed. // Should call after 'ForCluster', otherwise no-ops. Start(cluster string, stopCh <-chan struct{}) // WaitForCacheSync waits for all caches to populate. // Should call after 'ForCluster', otherwise no-ops. WaitForCacheSync(cluster string, stopCh <-chan struct{}) map[schema.GroupVersionResource]bool }
MultiClusterInformerManager manages dynamic shared informer for all resources, include Kubernetes resource and custom resources defined by CustomResourceDefinition, across multi-cluster.
func NewMultiClusterInformerManager ¶
func NewMultiClusterInformerManager() MultiClusterInformerManager
NewMultiClusterInformerManager constructs a new instance of multiClusterInformerManagerImpl.
type SingleClusterInformerManager ¶
type SingleClusterInformerManager interface { // ForResource builds a dynamic shared informer for 'resource' then set event handler. // If the informer already exist, the event handler will be appended to the informer. // The handler should not be nil. ForResource(resource schema.GroupVersionResource, handler cache.ResourceEventHandler) // IsHandlerExist checks if handler already added to a the informer that watches the 'resource'. IsHandlerExist(resource schema.GroupVersionResource, handler cache.ResourceEventHandler) bool // Lister returns a generic lister used to get 'resource' from informer's store. // The informer for 'resource' will be created if not exist, but without any event handler. Lister(resource schema.GroupVersionResource) cache.GenericLister // Start will run all informers with a stop channel, the informers will keep running until channel closed. // It is intended to be called after create new informer(s), and it's safe to call multi times. Start(stopCh <-chan struct{}) // WaitForCacheSync waits for all caches to populate. WaitForCacheSync(stopCh <-chan struct{}) map[schema.GroupVersionResource]bool }
SingleClusterInformerManager manages dynamic shared informer for all resources, include Kubernetes resource and custom resources defined by CustomResourceDefinition.
func NewSingleClusterInformerManager ¶
func NewSingleClusterInformerManager(client dynamic.Interface, defaultResync time.Duration) SingleClusterInformerManager
NewSingleClusterInformerManager constructs a new instance of singleClusterInformerManagerImpl. defaultResync with value '0' means no re-sync.