controller

package
v0.0.0-...-318a3d5 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const SequenceEvaluationService = "lighthouse-service"
View Source
const TestShipyardFile = `` /* 1033-byte string literal not displayed */

Variables

This section is empty.

Functions

func GetStageFromShipyard

func GetStageFromShipyard(stageName string, shipyard *keptnv2.Shipyard) *keptnv2.Stage

func GetTaskSequenceInStage

func GetTaskSequenceInStage(stageName, taskSequenceName string, shipyard *keptnv2.Shipyard) (*keptnv2.Sequence, error)

func GetTestFinishedEventWithUnmatchedSource

func GetTestFinishedEventWithUnmatchedSource() apimodels.KeptnContextExtendedCE

func GetTestStartedEvent

func GetTestStartedEvent() apimodels.KeptnContextExtendedCE

func GetTestStartedEventWithUnmatchedTriggeredID

func GetTestStartedEventWithUnmatchedTriggeredID() apimodels.KeptnContextExtendedCE

func GetTestTriggeredEvent

func GetTestTriggeredEvent() apimodels.KeptnContextExtendedCE

func ObjToJSON

func ObjToJSON(obj interface{}) string

func ShouldContainEvent

func ShouldContainEvent(t *testing.T, events []apimodels.KeptnContextExtendedCE, eventType string, stage string, eval func(t *testing.T, event apimodels.KeptnContextExtendedCE) bool)

func ShouldNotContainEvent

func ShouldNotContainEvent(t *testing.T, events []apimodels.KeptnContextExtendedCE, eventType string, stage string)

Types

type EventDispatcher

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

EventDispatcher is an implementation of IEventDispatcher It regularly fetches (queued) events from the database and eventually forwards them to the event broker

func NewEventDispatcher

func NewEventDispatcher(
	eventRepo db.EventRepo,
	eventQueueRepo db.EventQueueRepo,
	sequenceExecutionRepo db.SequenceExecutionRepo,
	eventSender keptncommon.EventSender,
	syncInterval time.Duration,
) *EventDispatcher

NewEventDispatcher creates a new EventDispatcher

func (*EventDispatcher) Add

func (e *EventDispatcher) Add(event models.DispatcherEvent, skipQueue bool) error

Add adds a DispatcherEvent to the event queue

func (*EventDispatcher) OnSequenceAborted

func (e *EventDispatcher) OnSequenceAborted(eventScope models.EventScope)

func (*EventDispatcher) OnSequenceFinished

func (e *EventDispatcher) OnSequenceFinished(event apimodels.KeptnContextExtendedCE)

func (*EventDispatcher) OnSequenceTimeout

func (e *EventDispatcher) OnSequenceTimeout(event apimodels.KeptnContextExtendedCE)

func (*EventDispatcher) Run

func (e *EventDispatcher) Run(ctx context.Context)

Run starts the event dispatcher loop which will periodically fetch (queued) events from the database and eventually forward/send them to the event broker The fetch interval is configured when creating a EventDispatcher using the "syncInterval" field

func (*EventDispatcher) Stop

func (e *EventDispatcher) Stop()

type EventScope

type EventScope struct {
	Project string `json:"project"`
	Stage   string `json:"stage"`
	Service string `json:"service"`
}

type IEventDispatcher

type IEventDispatcher interface {
	Add(event models.DispatcherEvent, skipQueue bool) error
	Run(ctx context.Context)
	Stop()
}

IEventDispatcher is responsible for dispatching events to be sent to the event broker

type ISequenceAbortedHook

type ISequenceAbortedHook interface {
	OnSequenceAborted(event models.EventScope)
}

type ISequenceDispatcher

type ISequenceDispatcher interface {
	Add(queueItem models.QueueItem) error
	Run(ctx context.Context, mode common.SDMode, startSequenceFunc func(event apimodels.KeptnContextExtendedCE) error)
	Remove(eventScope models.EventScope) error
	Stop()
}

ISequenceDispatcher is responsible for dispatching events to be sent to the event broker

func NewSequenceDispatcher

func NewSequenceDispatcher(
	eventRepo db.EventRepo,
	sequenceQueueRepo db.SequenceQueueRepo,
	sequenceExecutionRepo db.SequenceExecutionRepo,
	syncInterval time.Duration,
	theClock clock.Clock,
	mode common.SDMode,
) ISequenceDispatcher

NewSequenceDispatcher creates a new SequenceDispatcher

type ISequenceFinishedHook

type ISequenceFinishedHook interface {
	OnSequenceFinished(event apimodels.KeptnContextExtendedCE)
}

type ISequencePausedHook

type ISequencePausedHook interface {
	OnSequencePaused(pause models.EventScope)
}

type ISequenceResumedHook

type ISequenceResumedHook interface {
	OnSequenceResumed(resume models.EventScope)
}

type ISequenceStartedHook

type ISequenceStartedHook interface {
	OnSequenceStarted(apimodels.KeptnContextExtendedCE)
}

type ISequenceTaskEventHook

type ISequenceTaskEventHook interface {
	OnSequenceTaskEvent(apimodels.KeptnContextExtendedCE)
}

type ISequenceTimeoutHook

type ISequenceTimeoutHook interface {
	OnSequenceTimeout(event apimodels.KeptnContextExtendedCE)
}

type ISequenceTriggeredHook

type ISequenceTriggeredHook interface {
	OnSequenceTriggered(apimodels.KeptnContextExtendedCE)
}

type ISequenceWaitingHook

type ISequenceWaitingHook interface {
	OnSequenceWaiting(apimodels.KeptnContextExtendedCE)
}

type IShipyardController

type IShipyardController interface {
	GetAllTriggeredEvents(filter common.EventFilter) ([]apimodels.KeptnContextExtendedCE, error)
	GetTriggeredEventsOfProject(project string, filter common.EventFilter) ([]apimodels.KeptnContextExtendedCE, error)
	HandleIncomingEvent(event apimodels.KeptnContextExtendedCE, waitForCompletion bool) error
	ControlSequence(controlSequence apimodels.SequenceControl) error
	StartTaskSequence(event apimodels.KeptnContextExtendedCE) error
	StartDispatchers(ctx context.Context, mode common.SDMode)
	StopDispatchers()
}

type ISubSequenceFinishedHook

type ISubSequenceFinishedHook interface {
	OnSubSequenceFinished(event apimodels.KeptnContextExtendedCE)
}

type NextTaskSequence

type NextTaskSequence struct {
	Sequence  keptnv2.Sequence
	StageName string
}

func GetTaskSequencesByTrigger

func GetTaskSequencesByTrigger(eventScope models.EventScope, completedTaskSequence string, shipyard *keptnv2.Shipyard, previousTask string) []NextTaskSequence

type SequenceDispatcher

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

func (*SequenceDispatcher) Add

func (sd *SequenceDispatcher) Add(queueItem models.QueueItem) error

func (*SequenceDispatcher) Remove

func (sd *SequenceDispatcher) Remove(eventScope models.EventScope) error

func (*SequenceDispatcher) Run

func (sd *SequenceDispatcher) Run(ctx context.Context, mode common.SDMode, startSequenceFunc func(event apimodels.KeptnContextExtendedCE) error)

func (*SequenceDispatcher) SetStartSequenceCallback

func (sd *SequenceDispatcher) SetStartSequenceCallback(startSequenceFunc func(event apimodels.KeptnContextExtendedCE) error)

func (*SequenceDispatcher) Stop

func (sd *SequenceDispatcher) Stop()

type SequenceStateMaterializedView

type SequenceStateMaterializedView struct {
	SequenceStateRepo db.SequenceStateRepo
	// contains filtered or unexported fields
}

func NewSequenceStateMaterializedView

func NewSequenceStateMaterializedView(stateRepo db.SequenceStateRepo) *SequenceStateMaterializedView

func (*SequenceStateMaterializedView) OnSequenceAborted

func (smv *SequenceStateMaterializedView) OnSequenceAborted(eventScope models.EventScope)

func (*SequenceStateMaterializedView) OnSequenceFinished

func (smv *SequenceStateMaterializedView) OnSequenceFinished(event apimodels.KeptnContextExtendedCE)

func (*SequenceStateMaterializedView) OnSequencePaused

func (smv *SequenceStateMaterializedView) OnSequencePaused(pause models.EventScope)

func (*SequenceStateMaterializedView) OnSequenceResumed

func (smv *SequenceStateMaterializedView) OnSequenceResumed(resume models.EventScope)

func (*SequenceStateMaterializedView) OnSequenceStarted

func (smv *SequenceStateMaterializedView) OnSequenceStarted(event apimodels.KeptnContextExtendedCE)

func (*SequenceStateMaterializedView) OnSequenceTaskEvent

func (smv *SequenceStateMaterializedView) OnSequenceTaskEvent(event apimodels.KeptnContextExtendedCE)

func (*SequenceStateMaterializedView) OnSequenceTimeout

func (smv *SequenceStateMaterializedView) OnSequenceTimeout(event apimodels.KeptnContextExtendedCE)

func (*SequenceStateMaterializedView) OnSequenceTriggered

func (smv *SequenceStateMaterializedView) OnSequenceTriggered(event apimodels.KeptnContextExtendedCE)

func (*SequenceStateMaterializedView) OnSequenceWaiting

func (smv *SequenceStateMaterializedView) OnSequenceWaiting(event apimodels.KeptnContextExtendedCE)

func (*SequenceStateMaterializedView) OnSubSequenceFinished

func (smv *SequenceStateMaterializedView) OnSubSequenceFinished(event apimodels.KeptnContextExtendedCE)

func (*SequenceStateMaterializedView) UpdateLastEventOfSequence

type SequenceWatcher

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

func NewSequenceWatcher

func NewSequenceWatcher(cancelSequenceChannel chan apimodels.SequenceTimeout, eventRepo db.EventRepo, eventQueueRepo db.EventQueueRepo, projectRepo db.ProjectRepo, eventTimeout time.Duration, syncInterval time.Duration, theClock clock.Clock) *SequenceWatcher

func (*SequenceWatcher) Run

func (sw *SequenceWatcher) Run(ctx context.Context)

type ShipyardController

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

func GetShipyardControllerInstance

func GetShipyardControllerInstance(
	ctx context.Context,
	eventDispatcher IEventDispatcher,
	sequenceDispatcher ISequenceDispatcher,
	sequenceTimeoutChannel chan apimodels.SequenceTimeout,
	shipyardRetriever shipyardretriever.IShipyardRetriever,
) *ShipyardController

func (*ShipyardController) AddSequenceAbortedHook

func (sc *ShipyardController) AddSequenceAbortedHook(hook ISequenceAbortedHook)

func (*ShipyardController) AddSequenceFinishedHook

func (sc *ShipyardController) AddSequenceFinishedHook(hook ISequenceFinishedHook)

func (*ShipyardController) AddSequencePausedHook

func (sc *ShipyardController) AddSequencePausedHook(hook ISequencePausedHook)

func (*ShipyardController) AddSequenceResumedHook

func (sc *ShipyardController) AddSequenceResumedHook(hook ISequenceResumedHook)

func (*ShipyardController) AddSequenceStartedHook

func (sc *ShipyardController) AddSequenceStartedHook(hook ISequenceStartedHook)

func (*ShipyardController) AddSequenceTaskEventHook

func (sc *ShipyardController) AddSequenceTaskEventHook(hook ISequenceTaskEventHook)

func (*ShipyardController) AddSequenceTimeoutHook

func (sc *ShipyardController) AddSequenceTimeoutHook(hook ISequenceTimeoutHook)

func (*ShipyardController) AddSequenceTriggeredHook

func (sc *ShipyardController) AddSequenceTriggeredHook(hook ISequenceTriggeredHook)

func (*ShipyardController) AddSequenceWaitingHook

func (sc *ShipyardController) AddSequenceWaitingHook(hook ISequenceWaitingHook)

func (*ShipyardController) AddSubSequenceFinishedHook

func (sc *ShipyardController) AddSubSequenceFinishedHook(hook ISubSequenceFinishedHook)

func (*ShipyardController) ControlSequence

func (sc *ShipyardController) ControlSequence(controlSequence apimodels.SequenceControl) error

func (*ShipyardController) GetAllTriggeredEvents

func (sc *ShipyardController) GetAllTriggeredEvents(filter common.EventFilter) ([]apimodels.KeptnContextExtendedCE, error)

func (*ShipyardController) GetTriggeredEventsOfProject

func (sc *ShipyardController) GetTriggeredEventsOfProject(projectName string, filter common.EventFilter) ([]apimodels.KeptnContextExtendedCE, error)

func (*ShipyardController) HandleIncomingEvent

func (sc *ShipyardController) HandleIncomingEvent(event apimodels.KeptnContextExtendedCE, waitForCompletion bool) error

func (ShipyardController) StartDispatchers

func (sc ShipyardController) StartDispatchers(ctx context.Context, mode common.SDMode)

func (*ShipyardController) StartTaskSequence

func (sc *ShipyardController) StartTaskSequence(event apimodels.KeptnContextExtendedCE) error

func (ShipyardController) StopDispatchers

func (sc ShipyardController) StopDispatchers()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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