informerfactory

package
v0.0.0-...-a142011 Latest Latest
Warning

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

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

Documentation

Overview

Package informerfactory provides a "factory" to generate informers. This allows users to create the same informers in multiple different locations, while still using the same underlying resources. Additionally, aggregate operations like Start, Shutdown, and Wait are available. Kubernetes core has informer factories with very similar logic. However, this has a few problems that spurred a fork: * Factories are per package. That means we have ~6 distinct factories, which makes management a hassle. * Across these, the factories are often inconsistent in functionality. Changes to these takes >4 months. * Lack of functionality we want (see below).

Added functionality: * Single factory for any type, including dynamic informers, meta informers, typed informers, etc. * Ability to create multiple informers of the same type but with different filters. * Ability to run a single informer rather than all of them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InformerFactory

type InformerFactory interface {
	// Start initializes all requested informers. They are handled in goroutines
	// which run until the stop channel gets closed.
	Start(stopCh <-chan struct{})

	// InformerFor returns the SharedIndexInformer the provided type.
	InformerFor(resource schema.GroupVersionResource, opts kubetypes.InformerOptions, newFunc NewInformerFunc) StartableInformer

	// WaitForCacheSync blocks until all started informers' caches were synced
	// or the stop channel gets closed.
	WaitForCacheSync(stopCh <-chan struct{}) bool

	// Shutdown marks a factory as shutting down. At that point no new
	// informers can be started anymore and Start will return without
	// doing anything.
	//
	// In addition, Shutdown blocks until all goroutines have terminated. For that
	// to happen, the close channel(s) that they were started with must be closed,
	// either before Shutdown gets called or while it is waiting.
	//
	// Shutdown may be called multiple times, even concurrently. All such calls will
	// block until all goroutines have terminated.
	Shutdown()
}

InformerFactory provides access to a shared informer factory

func NewSharedInformerFactory

func NewSharedInformerFactory() InformerFactory

NewSharedInformerFactory constructs a new instance of informerFactory for all namespaces.

type NewInformerFunc

type NewInformerFunc func() cache.SharedIndexInformer

NewInformerFunc returns a SharedIndexInformer.

type StartableInformer

type StartableInformer struct {
	Informer cache.SharedIndexInformer
	// contains filtered or unexported fields
}

func (StartableInformer) Start

func (s StartableInformer) Start(stopCh <-chan struct{})

Jump to

Keyboard shortcuts

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