events

package
v0.0.0-...-932eec2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventSourceControlledLabel = "controlled-by-eventsource"
	TriggerControlledLabel     = "controlled-by-trigger"
	EventBusNameLabel          = "eventbus-name"
	EventBusTopicName          = "eventbus-topic-name"

	DefaultLogLevel = "1"

	// EventSourceComponentNameTmpl => esc(EventSource Component)-{sourceKind}-{eventName}
	EventSourceComponentNameTmpl = "esc-%s-%s"
	// EventSourceBusComponentNameTmpl => ebfes(EventBus for EventSource)-{eventSourceName}
	EventSourceBusComponentNameTmpl = "ebfes-%s"
	// TriggerBusComponentNameTmpl => ebft(EventBus for Trigger)-{triggerName}
	TriggerBusComponentNameTmpl = "ebft-%s"
	// SinkComponentNameTmpl => ts-{resourceName}-{sinkNamespace}
	SinkComponentNameTmpl = "ts-%s-%s"

	// EventSourceWorkloadsNameTmpl => esw(EventSource Workloads)-{eventSourceName}-{sourceKind}-{eventName}
	EventSourceWorkloadsNameTmpl = "esw-%s-%s-%s"
	// TriggerWorkloadsNameTmpl => t(Trigger)-{triggerName}
	TriggerWorkloadsNameTmpl = "t-%s"
	// EventBusTopicNameTmpl => {namespace}-{eventSourceName}-{eventName}
	EventBusTopicNameTmpl = "%s-%s-%s"

	// EventBusOutputNameTmpl => ebo(EventBus output)-{topicName}
	EventBusOutputNameTmpl = "ebo-%s"
	// SinkOutputNameTmpl => so(Sink output)-{resourceType}-{resourceName}-{index}
	SinkOutputNameTmpl = "so-%s-%s-%s"
	// EventSourceInputNameTmpl => esi(EventSource input)-{eventName}
	EventSourceInputNameTmpl = "esi-%s"
	// TriggerInputNameTmpl => ti(Trigger input)-{topicName}
	TriggerInputNameTmpl = "ti-%s"

	// SourceKindKafka indicates kafka event source
	SourceKindKafka = "kafka"
	// SourceKindCron indicates cron (scheduler) event source
	SourceKindCron = "cron"
	// SourceKindMQTT indicates mqtt event source
	SourceKindMQTT = "mqtt"
	// SourceKindRedis indicates redis event source
	SourceKindRedis = "redis"
)

Variables

This section is empty.

Functions

func InitFunction

func InitFunction(image string) *ofcore.Function

Types

type EventSourceConfig

type EventSourceConfig struct {
	EventBusComponent  string `json:"eventBusComponent,omitempty"`
	EventBusOutputName string `json:"eventBusOutputName,omitempty"`
	EventBusTopic      string `json:"eventBusTopic,omitempty"`
	SinkOutputName     string `json:"sinkOutputName,omitempty"`
	LogLevel           string `json:"logLevel,omitempty"`
}

func (*EventSourceConfig) DecodeEnv

func (e *EventSourceConfig) DecodeEnv(encodedConfig string) (*EventSourceConfig, error)

func (*EventSourceConfig) EncodeConfig

func (e *EventSourceConfig) EncodeConfig() (string, error)

type EventSourceReconciler

type EventSourceReconciler struct {
	client.Client
	Log               logr.Logger
	Scheme            *runtime.Scheme
	EventSourceConfig *EventSourceConfig
	Function          *ofcore.Function
	// contains filtered or unexported fields
}

EventSourceReconciler reconciles a EventSource object

func (*EventSourceReconciler) Reconcile

func (r *EventSourceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the EventSource object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile

func (*EventSourceReconciler) SetupWithManager

func (r *EventSourceReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type Input

type Input struct {
	Name        string `json:"name"`
	Namespace   string `json:"namespace,omitempty"`
	EventSource string `json:"eventSource"`
	Event       string `json:"event"`
}

type Subscriber

type Subscriber struct {
	SinkOutputName       string `json:"sinkOutputName,omitempty"`
	DLSinkOutputName     string `json:"dlSinkOutputName,omitempty"`
	EventBusOutputName   string `json:"eventBusOutputName,omitempty"`
	DLEventBusOutputName string `json:"dlEventBusOutputName,omitempty"`
}

type Subscribers

type Subscribers struct {
	Sinks            []*ofevent.SinkSpec `json:"sinks,omitempty"`
	DeadLetterSinks  []*ofevent.SinkSpec `json:"deadLetterSinks,omitempty"`
	TotalSinks       []*ofevent.SinkSpec `json:"totalSinks,omitempty"`
	Topics           []string            `json:"topics,omitempty"`
	DeadLetterTopics []string            `json:"deadLetterTopics,omitempty"`
	TotalTopics      []string            `json:"totalTopics,omitempty"`
}

type TriggerConfig

type TriggerConfig struct {
	EventBusComponent string                 `json:"eventBusComponent,omitempty"`
	Inputs            []*Input               `json:"inputs,omitempty"`
	Subscribers       map[string]*Subscriber `json:"subscribers,omitempty"`
	LogLevel          string                 `json:"logLevel,omitempty"`
}

func (*TriggerConfig) DecodeEnv

func (e *TriggerConfig) DecodeEnv(encodedConfig string) (*TriggerConfig, error)

func (*TriggerConfig) EncodeConfig

func (e *TriggerConfig) EncodeConfig() (string, error)

type TriggerReconciler

type TriggerReconciler struct {
	client.Client
	Log           logr.Logger
	Scheme        *runtime.Scheme
	TriggerConfig *TriggerConfig
	Function      *ofcore.Function
	// contains filtered or unexported fields
}

TriggerReconciler reconciles a Trigger object

func (*TriggerReconciler) Reconcile

func (r *TriggerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the Trigger object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile

func (*TriggerReconciler) SetupWithManager

func (r *TriggerReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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