informers

package
v2.30.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: Apache-2.0 Imports: 19 Imported by: 93

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSharedIndexInformer

func NewSharedIndexInformer(lw cache.ListerWatcher, exampleObject runtime.Object, defaultEventHandlerResyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer

NewSharedIndexInformer creates a new instance for the ListerWatcher and specified Indexers. See NewSharedIndexInformerWithOptions for full details.

func NewSharedIndexInformerWithOptions added in v2.29.0

func NewSharedIndexInformerWithOptions(lw cache.ListerWatcher, exampleObject runtime.Object, options cache.SharedIndexInformerOptions) kcpcache.ScopeableSharedIndexInformer

NewSharedIndexInformerWithOptions creates a new instance for the ListerWatcher. The created informer will not do resyncs if options.ResyncPeriod is zero. Otherwise: for each handler that with a non-zero requested resync period, whether added before or after the informer starts, the nominal resync period is the requested resync period rounded up to a multiple of the informer's resync checking period. Such an informer's resync checking period is established when the informer starts running, and is the maximum of (a) the minimum of the resync periods requested before the informer starts and the options.ResyncPeriod given here and (b) the constant `minimumResyncPeriod` defined in this file.

func NewSharedInformer

func NewSharedInformer(lw cache.ListerWatcher, exampleObject runtime.Object, defaultEventHandlerResyncPeriod time.Duration) cache.SharedInformer

NewSharedInformer creates a new instance for the ListerWatcher. See NewSharedIndexInformerWithOptions for full details.

func WaitForCacheSync added in v2.30.0

func WaitForCacheSync(stopCh <-chan struct{}, cacheSyncs ...InformerSynced) bool

WaitForCacheSync waits for caches to populate. It returns true if it was successful, false if the controller should shutdown callers should prefer WaitForNamedCacheSync()

func WaitForNamedCacheSync added in v2.30.0

func WaitForNamedCacheSync(controllerName string, stopCh <-chan struct{}, cacheSyncs ...InformerSynced) bool

WaitForNamedCacheSync is a wrapper around WaitForCacheSync that generates log messages indicating that the caller identified by name is waiting for syncs, followed by either a successful or failed sync.

Contextual logging: WaitForNamedCacheSyncWithContext should be used instead of WaitForNamedCacheSync in code which supports contextual logging.

func WaitForNamedCacheSyncWithContext added in v2.30.0

func WaitForNamedCacheSyncWithContext(ctx context.Context, cacheSyncs ...InformerSynced) bool

WaitForNamedCacheSyncWithContext is a wrapper around WaitForCacheSyncWithContext that generates log messages indicating that the caller is waiting for syncs, followed by either a successful or failed sync.

Contextual logging can be used to identify the caller in those log messages. The log level is zero, the same as in WaitForNamedCacheSync. If this is too verbose, then store a logger with an increased threshold in the context:

WaitForNamedCacheSyncWithContext(klog.NewContext(ctx, logger.V(5)), ...)

Types

type HandlerOptions added in v2.29.0

type HandlerOptions struct {
	// Logger overrides the default klog.Background() logger.
	Logger *klog.Logger

	// ResyncPeriod requests a certain resync period from an informer. Zero
	// means the handler does not care about resyncs. Not all informers do
	// resyncs, even if requested. See
	// [SharedInformer.AddEventHandlerWithResyncPeriod] for details.
	//
	// If nil, the default resync period of the shared informer is used.
	ResyncPeriod *time.Duration
}

Optional configuration options for [SharedInformer.AddEventHandlerWithOptions]. May be left empty.

type InformerSynced added in v2.30.0

type InformerSynced func() bool

InformerSynced is a function that can be used to determine if an informer has synced. This is useful for determining if caches have synced.

Jump to

Keyboard shortcuts

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