Documentation
¶
Index ¶
- func NewController(client dynamic.NamespaceableResourceInterface, ...) *notificationController
- func NewControllerWithNamespaceSupport(client dynamic.NamespaceableResourceInterface, ...) *notificationController
- func StateItemKey(isSelfConfig bool, apiNamespace, trigger string, ...) string
- type MetricsRegistry
- type NotificationController
- type NotificationDelivery
- type NotificationEventSequence
- type NotificationsState
- type Opts
- func WithAlterDestinations(...) Opts
- func WithEventCallback(f func(eventSequence NotificationEventSequence)) Opts
- func WithMetricsRegistry(r *MetricsRegistry) Opts
- func WithSkipProcessing(f func(obj metav1.Object) (bool, string)) Opts
- func WithToUnstructured(f func(obj metav1.Object) (*unstructured.Unstructured, error)) Opts
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 ¶
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) 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 WithToUnstructured ¶
func WithToUnstructured(f func(obj metav1.Object) (*unstructured.Unstructured, error)) Opts
Click to show internal directories.
Click to hide internal directories.