source

package
v0.17.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

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

Dispatcher provides functionality to starts a given plugin, watches for incoming events and calling all notifiers to dispatch received event.

func NewDispatcher

func NewDispatcher(log logrus.FieldLogger, notifiers []notifier.Notifier, manager *plugin.Manager) *Dispatcher

NewDispatcher create a new Dispatcher instance.

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(ctx context.Context, pluginName string, pluginConfigs []*source.Config, sources []string) error

Dispatch starts a given plugin, watches for incoming events and calling all notifiers to dispatch received event. Once we will have the gRPC contract established with proper Cloud Event schema, we should move also this logic here: https://github.com/kubeshop/botkube/blob/525c737956ff820a09321879284037da8bf5d647/pkg/controller/controller.go#L200-L253

type Router

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

Router routes handled event types from registered informers to configured sources

func NewRouter

func NewRouter(mapper meta.RESTMapper, dynamicCli dynamic.Interface, log logrus.FieldLogger) *Router

NewRouter creates a new router to use for routing event types to registered informers.

func (*Router) AddBindings

func (r *Router) AddBindings(b config.BotBindings) *Router

AddBindings adds source binding names to dictate which source bindings the router should use.

func (*Router) AddBindingsByIDIfConditionTrue

func (r *Router) AddBindingsByIDIfConditionTrue(condition bool, c config.IdentifiableMap[config.ChannelBindingsByID]) *Router

AddBindingsByIDIfConditionTrue adds source binding names to dictate which source bindings the router should use.

func (*Router) AddBindingsByNameIfConditionTrue

func (r *Router) AddBindingsByNameIfConditionTrue(condition bool, c config.IdentifiableMap[config.ChannelBindingsByName]) *Router

AddBindingsByNameIfConditionTrue adds source binding names to dictate which source bindings the router should use.

func (*Router) AddBindingsIfConditionTrue

func (r *Router) AddBindingsIfConditionTrue(condition bool, b config.BotBindings) *Router

AddBindingsIfConditionTrue adds source binding names to dictate which source bindings the router should use.

func (*Router) AddCommunicationsBindings

func (r *Router) AddCommunicationsBindings(c config.Communications)

AddCommunicationsBindings adds source binding from a given communications

func (*Router) AddElsIndexSinkBindingsIfConditionTrue

func (r *Router) AddElsIndexSinkBindingsIfConditionTrue(condition bool, b map[string]config.ELSIndex) *Router

AddElsIndexSinkBindingsIfConditionTrue adds source bindings names to dictate which source bindings the router should use.

func (*Router) AddEnabledActionBindings

func (r *Router) AddEnabledActionBindings(c config.Actions)

AddEnabledActionBindings adds source bindings for enabled Actions.

func (*Router) AddSinkBindingsIfConditionTrue

func (r *Router) AddSinkBindingsIfConditionTrue(condition bool, b config.SinkBindings) *Router

AddSinkBindingsIfConditionTrue adds source bindings names to dictate which source bindings the router should use.

func (*Router) BuildTable

func (r *Router) BuildTable(cfg *config.Config) *Router

BuildTable builds the routers routing table marking it ready to register, map and handle informer events.

func (*Router) GetBoundSources

func (r *Router) GetBoundSources(sources map[string]config.Sources) map[string]config.Sources

GetBoundSources returns the Sources the router uses based on preconfigured source binding names.

func (*Router) HandleMappedEvent

func (r *Router) HandleMappedEvent(ctx context.Context, targetEvent config.EventType, handlerFn eventHandler)

HandleMappedEvent allows router clients to create handlers that are triggered for a target mapped event.

func (*Router) MapWithEventsInformer

func (r *Router) MapWithEventsInformer(srcEvent config.EventType, dstEvent config.EventType, handler registrationHandler) error

MapWithEventsInformer allows resources to report on an event (srcEvent) that can only be observed by watching the general k8s v1/events resource using a different event (dstEvent).

For example, you can report the "error" EventType for a resource by having the router watch/interrogate the "warning" EventType reported by the v1/events resource.

func (*Router) RegisterEventHandler

func (r *Router) RegisterEventHandler(ctx context.Context, eventType config.EventType, handlerFn eventHandler)

RegisterEventHandler allows router clients to create handlers that are triggered for a target event.

func (*Router) RegisterInformers

func (r *Router) RegisterInformers(targetEvents []config.EventType, handler registrationHandler) error

RegisterInformers register informers for all the resources that match the target events.

type Scheduler

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

Scheduler analyzes the provided configuration and based on that schedules plugin sources.

func NewScheduler

func NewScheduler(log logrus.FieldLogger, cfg *config.Config, dispatcher pluginDispatcher) *Scheduler

NewScheduler create a new Scheduler instance.

func (*Scheduler) Start

func (d *Scheduler) Start(ctx context.Context) error

Start starts all sources and dispatch received events.

Jump to

Keyboard shortcuts

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