informer

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceInformer

type ResourceInformer struct {
	// contains filtered or unexported fields
}

ResourceInformer represents a "subscription" to a shared informer and lister.

Users of this package shouldn't create ResourceInformers directly. The SharedInformerFactory returns a new ResourceInformer for each request, but multiple ResourceInformers may share the same underlying informer if they are for the same apiVersion and resource.

When you're done with a ResourceInformer, you should call Close() on it. Once all ResourceInformers for a shared informer are closed, the shared informer is stopped.

func (*ResourceInformer) Close

func (ri *ResourceInformer) Close()

Close marks this ResourceInformer as unused, allowing the underlying shared informer to be stopped when no users are left. You should call this when you no longer need the informer, so the watches and relists can be stopped.

func (*ResourceInformer) Informer

func (ri *ResourceInformer) Informer() SharedIndexInformer

Informer returns an interface to the dynamic, shared informer. If you add any event handlers with this interface, you should arrange to call RemoveEventHandlers() when you want to stop receiving events.

func (*ResourceInformer) Lister

func (ri *ResourceInformer) Lister() *dynamiclister.Lister

Lister returns a shared, dynamic lister that's analogous to the static listers generated for static types.

type SharedIndexInformer

type SharedIndexInformer interface {
	cache.SharedIndexInformer

	// RemoveEventHandlers removes all event handlers added through this instance
	// of SharedIndexInformer. It does not affect other handlers on the same
	// underlying shared informer.
	//
	// This is necessary because the underlying shared informer may continue
	// running if others are using it, so you should remove the handlers you added
	// when you're no longer interested in receiving events.
	RemoveEventHandlers()
}

SharedIndexInformer is an extension of the standard interface of the same name, adding the ability to remove event handlers that you added.

type SharedInformerFactory

type SharedInformerFactory struct {
	// contains filtered or unexported fields
}

SharedInformerFactory is a factory for requesting dynamic informers from a shared pool. It's analogous to the static SharedInformerFactory generated for static types.

func NewSharedInformerFactory

func NewSharedInformerFactory(clientset *dynamicclientset.Clientset, defaultResync time.Duration) *SharedInformerFactory

NewSharedInformerFactory creates a new factory for shared, dynamic informers. Usually there is only one of these for the whole process, created in main().

func (*SharedInformerFactory) Resource

func (f *SharedInformerFactory) Resource(apiVersion, resource string) (*ResourceInformer, error)

Resource returns a dynamic informer and lister for the given resource. These are shared with any other controllers in the same process that request the same resource.

If this function returns successfully, the caller should ensure they call Close() on the returned ResourceInformer when they no longer need it. Shared informers that become unused will be stopped to minimize our load on the API server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL