informers

package
v4.0.0-...-cce7961 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New provides a convenient wrapper to initiate a GenericInformer associated with the provided informerFactory for a particular GVR. A GVR must be specified through either ForGVR option or one of the convenience wrappers around it in this package.

The primary difference between an Informer vs. a Watcher is that Informers handle re-connections automatically, so consumers don't need to handle watch errors.

func NewInformerFactory

NewInformerFactory is a convenient wrapper around initializing an informer factory for the purposes of awaiting Kubernetes resources for the provider. By default, the informer is configured for the "default" namespace. This can be overridden by WithNamespace. By default, the resync interval is configured for 60 seconds. This can be overridden by WithResyncInterval. By default, no constraints are placed on the listers. This can be overridden through WithTweakListOptionsFunc.

Types

type InformerFactoryOption

type InformerFactoryOption interface {
	// contains filtered or unexported methods
}

func WithNamespace

func WithNamespace(namespace string) InformerFactoryOption

WithNamespace configures the namespace for the informer factory created by NewInformerFactory.

func WithNamespaceOrDefault

func WithNamespaceOrDefault(namespace string) InformerFactoryOption

WithNamespaceOrDefault configures the namespace for the informer factory similar to WithNamespace, except the empty ("") namespace is interpreted as the "default" namespace.

func WithResyncInterval

func WithResyncInterval(interval time.Duration) InformerFactoryOption

WithResyncInterval overrides the default resync interval of 60 seconds. Setting this to 0 will disable resync. Refer to cache.NewSharedIndexInformer for caveats on how resync intervals are honored.

func WithTweakListOptionsFunc

func WithTweakListOptionsFunc(tweakListOptionsFunc dynamicinformer.TweakListOptionsFunc) InformerFactoryOption

WithTweakListOptionsFunc allows customizing options used by the informer's underlying cache.Lister. By default, no customizations are performed.

type InformerOption

type InformerOption interface {
	// contains filtered or unexported methods
}

func ForEndpoints

func ForEndpoints() InformerOption

ForEndpoints provides a shortcut for specifying "core/v1/endpoints" as a GVR.

func ForGVR

ForGVR configures the required GVR for the informer.

func ForJobs

func ForJobs() InformerOption

ForJobs provides a shortcut for specifying "batch/v1/jobs" as a GVR.

func ForPods

func ForPods() InformerOption

ForPods provides a shortcut for specifying "core/v1/pods" as a GVR.

func ForServices

func ForServices() InformerOption

ForServices provides a shortcut for specifying "core/v1/services" as a GVR.

func WithEventChannel

func WithEventChannel(ch chan<- watch.Event) InformerOption

WithEventChannel adds an event handler to the informer which sends which converts Add/Update/Delete callbacks to an appropriate watch.Event object and sent down the channel. This allows loosely mimicking the behavior expected in a low-level Watch but all caveats associated with cache.ResourceEventHandler apply.

Jump to

Keyboard shortcuts

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