controller

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

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

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

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

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 v1.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 v1.Object, destinations services.Destinations, cfg api.Config) services.Destinations) Opts

func WithEventCallback

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 v1.Object) (bool, string)) Opts

func WithToUnstructured

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

Jump to

Keyboard shortcuts

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