informers

package
v0.0.0-...-5bf033e Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 21 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCacheReadOnly = errors.New("cache is read-only")

ErrCacheReadOnly is returned for any attempted write.

Functions

func NewCacheReader

func NewCacheReader(indexer multiIndexer) cache.Indexer

NewCacheReader returns a new cache reader which satisfies the cache.Indexer interface and provides read-only access across the underlying caches for the given cross-namespace indexer. The argument is any type with a GetIndexers method that returns a map of namespaces to indexers.

func NewFilteredDynamicInformer

func NewFilteredDynamicInformer(client dynamic.Interface, gvr schema.GroupVersionResource, namespaces NamespaceSet, resyncPeriod time.Duration,
	indexers cache.Indexers, tweakListOptions TweakListOptionsFunc,
) informers.GenericInformer

NewFilteredDynamicInformer constructs a new informer for a dynamic type.

func NewFilteredMetadataInformer

func NewFilteredMetadataInformer(client metadata.Interface, gvr schema.GroupVersionResource, namespaces NamespaceSet, resyncPeriod time.Duration,
	indexers cache.Indexers, tweakListOptions TweakListOptionsFunc,
) informers.GenericInformer

NewFilteredMetadataInformer constructs a new informer for a metadata type.

Types

type DynamicSharedInformerFactory

type DynamicSharedInformerFactory interface {
	Start(stopCh <-chan struct{})
	SetNamespaces(namespaces []string)
	ForResource(gvr schema.GroupVersionResource) informers.GenericInformer
	WaitForCacheSync(stopCh <-chan struct{}) map[schema.GroupVersionResource]bool
	Shutdown()
}

DynamicSharedInformerFactory provides access to shared informers and listers for dynamic client.

Note that if you restrict the factory or an individual informer to a set of namespaces, it will not work for cluster-scoped resources.

func NewDynamicSharedInformerFactory

func NewDynamicSharedInformerFactory(client dynamic.Interface, defaultResync time.Duration) DynamicSharedInformerFactory

NewDynamicSharedInformerFactory constructs a new instance of dynamicSharedInformerFactory for all namespaces.

func NewFilteredDynamicSharedInformerFactory

func NewFilteredDynamicSharedInformerFactory(client dynamic.Interface, defaultResync time.Duration, namespaces NamespaceSet,
	tweakListOptions TweakListOptionsFunc,
) DynamicSharedInformerFactory

NewFilteredDynamicSharedInformerFactory constructs a new instance of dynamicSharedInformerFactory. Listers obtained via this factory will be subject to the same filters as specified here.

type MetadataSharedInformerFactory

type MetadataSharedInformerFactory interface {
	Start(stopCh <-chan struct{})
	SetNamespaces(namespaces []string)
	ForResource(gvr schema.GroupVersionResource) informers.GenericInformer
	WaitForCacheSync(stopCh <-chan struct{}) map[schema.GroupVersionResource]bool
}

MetadataSharedInformerFactory provides access to shared informers and listers for metadata client.

func NewFilteredMetadataSharedInformerFactory

func NewFilteredMetadataSharedInformerFactory(client metadata.Interface, defaultResync time.Duration, namespaces NamespaceSet,
	tweakListOptions TweakListOptionsFunc,
) MetadataSharedInformerFactory

NewFilteredMetadataSharedInformerFactory constructs a new instance of metadataSharedInformerFactory. Listers obtained via this factory will be subject to the same filters as specified here.

func NewMetadataSharedInformerFactory

func NewMetadataSharedInformerFactory(client metadata.Interface, defaultResync time.Duration) MetadataSharedInformerFactory

NewMetadataSharedInformerFactory constructs a new instance of metadataSharedInformerFactory for all namespaces.

type MultiNamespaceInformer

type MultiNamespaceInformer interface {
	cache.SharedIndexInformer

	AddNamespace(namespace string)
	RemoveNamespace(namespace string)
	GetIndexers() map[string]cache.Indexer
}

MultiNamespaceInformer extends the cache.SharedIndexInformer interface with methods relevant to cross-namespace informers.

func NewMultiNamespaceInformer

func NewMultiNamespaceInformer(namespaces NamespaceSet, resync time.Duration, newInformer NewInformerFunc) MultiNamespaceInformer

NewMultiNamespaceInformer returns a new cross-namespace informer. The given NewInformerFunc will be used to craft new single-namespace informers when adding namespaces.

type NamespaceSet

type NamespaceSet interface {
	// Initialized returns true if SetNamespaces() has been called at least once
	Initialized() bool
	SetNamespaces(namespaces []string)
	AddHandler(handler NamespaceSetHandler)
	Contains(namespace string) bool
	List() []string
}

NamespaceSet represents a dynamic set of namespaces. The set can be updated with SetNamespaces, and handlers can be added with AddHandler that will respond to addition or removal of individual namespaces.

func NewNamespaceSet

func NewNamespaceSet(namespaces ...string) NamespaceSet

NewNamespaceSet returns a new NamespaceSet tracking the given namespaces.

func NewUninitializedNamespaceSet

func NewUninitializedNamespaceSet() NamespaceSet

NewUninitializedNamespaceSet returns a new uninitialized NamespaceSet

type NamespaceSetHandler

type NamespaceSetHandler interface {
	OnAdd(namespace string)
	OnRemove(namespace string)
}

NamespaceSetHandler handles add and remove events for namespace sets.

type NamespaceSetHandlerFuncs

type NamespaceSetHandlerFuncs struct {
	AddFunc    func(namespace string)
	RemoveFunc func(namespace string)
}

NamespaceSetHandlerFuncs is a helper for implementing NamespaceSetHandler.

func (NamespaceSetHandlerFuncs) OnAdd

func (h NamespaceSetHandlerFuncs) OnAdd(namespace string)

OnAdd calls AddFunc if it is non-nil.

func (NamespaceSetHandlerFuncs) OnRemove

func (h NamespaceSetHandlerFuncs) OnRemove(namespace string)

OnRemove calls RemoveFunc if it is non-nil.

type NewInformerFunc

type NewInformerFunc func(namespace string) cache.SharedIndexInformer

NewInformerFunc returns a new informer for a given namespace.

type TweakListOptionsFunc

type TweakListOptionsFunc func(*metav1.ListOptions)

TweakListOptionsFunc defines the signature of a helper function that allows filtering in informers created by shared informer factories.

Jump to

Keyboard shortcuts

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