eventwatch

package
v0.0.0-...-52527b8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

func New

func New() *Builder

New returns a new event watch controller builder that allow to specify event handlers.

func (*Builder) ToController

func (b *Builder) ToController(kubeInformersForTargetNamespace informers.SharedInformerFactory, eventClient corev1typed.EventsGetter, recorder events.Recorder) factory.Controller

ToController returns a factory controller that can be run. The kubeInformersForTargetNamespace must have informer for namespaces which matching the registered event handlers. The event client is used to update/acknowledge events.

func (*Builder) WithEventHandler

func (b *Builder) WithEventHandler(namespace, reasonPattern string, processEvent func(event *corev1.Event) error) *Builder

WithEventHandler add handler for event matching the namespace and the reason pattern. This can be called multiple times. The reason pattern can contain glob ("*") as prefix or suffix. If no glob is used a strict match is required

type Controller

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

Controller observes the events in given informer namespaces and match them with configured event handlers. If the event reason and namespace match the configured, then the process() function is called in handler on that event. The event is then acknowledged via annotation update, so each interesting event is only processed once. The process() function will received the observed event and can update Prometheus counter or manage operator conditions.

Jump to

Keyboard shortcuts

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