controller

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: Apache-2.0 Imports: 22 Imported by: 11 modules, 13 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewController

func NewController(
	client dynamic.NamespaceableResourceInterface,
	informer cache.SharedIndexInformer,
	apiFactory api.Factory,
	opts ...Opts,
) *notificationController

func NewControllerWithNamespaceSupport added in v0.5.0

func NewControllerWithNamespaceSupport(
	client dynamic.NamespaceableResourceInterface,
	informer cache.SharedIndexInformer,
	apiFactory api.Factory,
	opts ...Opts,
) *notificationController

NewControllerWithNamespaceSupport For self-service notification

func StateItemKey

func StateItemKey(isSelfConfig bool, apiNamespace, trigger string, conditionResult triggers.ConditionResult, dest services.Destination) string

Types

type MetricsRegistry

type MetricsRegistry struct {
	*prometheus.Registry
	// contains filtered or unexported fields
}

func NewMetricsRegistry

func NewMetricsRegistry(prefix string) *MetricsRegistry

func (*MetricsRegistry) IncDeliveriesCounter

func (r *MetricsRegistry) IncDeliveriesCounter(trigger string, service string, succeeded bool)

func (*MetricsRegistry) IncTriggerEvaluationsCounter

func (r *MetricsRegistry) IncTriggerEvaluationsCounter(name string, triggered bool)

type NotificationController

type NotificationController interface {
	Run(threadiness int, stopCh <-chan struct{})
}

type NotificationDelivery added in v0.5.0

type NotificationDelivery struct {
	// Trigger is the trigger of the notification delivery
	Trigger string
	// Destination is the destination of the notification delivery
	Destination services.Destination
	// AlreadyNotified indicates that this notification was already delivered in a previous iteration
	AlreadyNotified bool
}

NotificationDelivery represents a notification that was delivered

type NotificationEventSequence added in v0.5.0

type NotificationEventSequence struct {
	// Key is the resource key. Format is the namespaced name
	Key string
	// Resource is the resource that was being processed when the event occurred
	Resource metav1.Object
	// Delivered is a list of notifications that were delivered
	Delivered []NotificationDelivery
	// Errors is a list of errors that occurred during the processing iteration
	Errors []error
	// Warnings is a list of warnings that occurred during the processing iteration
	Warnings []error
}

NotificationEventSequence represents a sequence of events that occurred while processing an object for notifications

type NotificationsState

type NotificationsState map[string]int64

NotificationsState track notification triggers state (already notified/not notified)

func NewState

func NewState(val string) NotificationsState

func NewStateFromRes

func NewStateFromRes(res metav1.Object) NotificationsState

func (NotificationsState) Persist

func (s NotificationsState) Persist(res metav1.Object) (map[string]string, error)

func (NotificationsState) SetAlreadyNotified

func (s NotificationsState) SetAlreadyNotified(isSelfConfig bool, apiNamespace, trigger string, result triggers.ConditionResult, dest services.Destination, isNotified bool) bool

SetAlreadyNotified set the state of given trigger/destination and return if state has been changed

type Opts

type Opts func(ctrl *notificationController)

func WithAlterDestinations

func WithAlterDestinations(f func(obj metav1.Object, destinations services.Destinations, cfg api.Config) services.Destinations) Opts

func WithEventCallback added in v0.5.0

func WithEventCallback(f func(eventSequence NotificationEventSequence)) Opts

WithEventCallback registers a callback to invoke when an object has been processed for notifications.

func WithMetricsRegistry

func WithMetricsRegistry(r *MetricsRegistry) Opts

func WithSkipProcessing

func WithSkipProcessing(f func(obj metav1.Object) (bool, string)) Opts

func WithToUnstructured

func WithToUnstructured(f func(obj metav1.Object) (*unstructured.Unstructured, error)) Opts

Jump to

Keyboard shortcuts

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