informer

package
v1.1.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package informer provides generic utilities to work with Kubernetes informers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Informer

type Informer struct {
	// contains filtered or unexported fields
}

Informer is a generic wrapper around the controller-runtime cache. It provides a minimalist interface for watching Kubernetes objects and triggering callbacks.

func New

func New(opts ...OptionsFunc) (*Informer, error)

New creates and returns a new Informer.

func (*Informer) OnAdd

func (i *Informer) OnAdd(cb func(obj interface{}))

OnAdd is triggered when an object is added.

func (*Informer) OnDelete

func (i *Informer) OnDelete(cb func(obj interface{}))

OnDelete is triggered when an object is deleted.

func (*Informer) OnUpdate

func (i *Informer) OnUpdate(cb func(oldObj, newObj interface{}))

OnUpdate is triggered when an object is updated.

func (*Informer) Start

func (i *Informer) Start(ctx context.Context, obj client.Object) error

Start the Informer.

type OptionsFunc

type OptionsFunc func(*Informer)

OptionsFunc is a function that sets options for the informer.

func Watches

func Watches(obj client.Object, ns ...string) OptionsFunc

Watches sets the Informer to watch the given object. If a namespace is provided, the Informer will only watch the object only in that namespace.

func WithConfig

func WithConfig(cfg *rest.Config) OptionsFunc

WithConfig sets the rest.Config for the Informer.

func WithLogger

func WithLogger(l *zap.SugaredLogger) OptionsFunc

WithLogger sets the logger for the Informer.

Jump to

Keyboard shortcuts

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