controller

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 22 Imported by: 9

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 StateItemKey

func StateItemKey(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 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(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 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