Documentation ¶
Index ¶
- Variables
- type AddHandler
- type DeleteHandler
- type Informer
- type InformerInterface
- type InformerOption
- func WithAddHandler[T runtime.Object](f AddHandler[T]) InformerOption[T]
- func WithDeleteHandler[T runtime.Object](f DeleteHandler[T]) InformerOption[T]
- func WithFilters[T runtime.Object](fc *filter.Chain[T]) InformerOption[T]
- func WithListHandler[T runtime.Object](f ListFunc) InformerOption[T]
- func WithMetrics[T runtime.Object](registry *prometheus.Registry, metrics *metrics.InformerMetrics) InformerOption[T]
- func WithNamespaceScope[T runtime.Object](namespace string) InformerOption[T]
- func WithResyncPeriod[T runtime.Object](d time.Duration) InformerOption[T]
- func WithUpdateHandler[T runtime.Object](f UpdateHandler[T]) InformerOption[T]
- func WithWatchHandler[T runtime.Object](f WatchFunc) InformerOption[T]
- type ListFunc
- type UpdateHandler
- type WatchFunc
Constants ¶
This section is empty.
Variables ¶
var ErrNoListFunc = errors.New("no list func defined")
var ErrNoWatchFunc = errors.New("no watch func defined")
var ErrNotRunning = errors.New("informer is not running")
var ErrRunning = errors.New("informer is running")
Functions ¶
This section is empty.
Types ¶
type AddHandler ¶
type DeleteHandler ¶
type Informer ¶
Informer is a generic informer, suitable for all Kubernetes types.
T specifies the type of the resource this informer should handle.
The informer must be supplied with at least a lister and a watcher function.
func NewInformer ¶
func NewInformer[T runtime.Object](ctx context.Context, opts ...InformerOption[T]) (*Informer[T], error)
NewInformer instantiates a new informer for resource type T.
You must supply at least a list and a watch function using WithLisHandler and WithWatchHandler.
Resource callbacks can be provided at the time of instantiation using WithAddHandler, WithUpdateHandler and WithDeleteHandler options.
type InformerInterface ¶
type InformerInterface interface { Start(ctx context.Context) error Stop() error HasSynced() bool WaitForSync(ctx context.Context) error }
InformerInterface defines the interface for the informer
type InformerOption ¶
func WithAddHandler ¶
func WithAddHandler[T runtime.Object](f AddHandler[T]) InformerOption[T]
WithAddHandler sets the callback to be executed when a resource is added
func WithDeleteHandler ¶
func WithDeleteHandler[T runtime.Object](f DeleteHandler[T]) InformerOption[T]
WithDeleteHandler sets the callback to be executed when a resource is deleted
func WithFilters ¶
func WithFilters[T runtime.Object](fc *filter.Chain[T]) InformerOption[T]
WithFilters sets the filter chain used by the informer to decide whether to admit specific resources. The filter chain must be for the same resource type T as the informer.
func WithListHandler ¶
func WithListHandler[T runtime.Object](f ListFunc) InformerOption[T]
WithListHandler sets the list function for the watcher
func WithMetrics ¶
func WithMetrics[T runtime.Object](registry *prometheus.Registry, metrics *metrics.InformerMetrics) InformerOption[T]
WithMetrics sets the informer metrics to be used by this informer
func WithNamespaceScope ¶
func WithNamespaceScope[T runtime.Object](namespace string) InformerOption[T]
WithNamespaceScope sets the scope of the informer to namespace. If namespace is the empty string, the informer will be cluster scoped (Which is also the default)
func WithResyncPeriod ¶
func WithResyncPeriod[T runtime.Object](d time.Duration) InformerOption[T]
WithResyncPeriod sets the resync period for the informer to d
func WithUpdateHandler ¶
func WithUpdateHandler[T runtime.Object](f UpdateHandler[T]) InformerOption[T]
WithUpdateHandler sets the callback to be executed when a resource is updated
func WithWatchHandler ¶
func WithWatchHandler[T runtime.Object](f WatchFunc) InformerOption[T]
WithWatchHandler sets the watch function for the watcher