Adding Bootstrap Event

In preparation to the support of Bootstrap Container/Ephemeral Cluster
feature, the following updates have been added:

- Added Bootstrap event type, structure and method in event.go
- added processing of Bootstrap event in processor.go

Change-Id: Ic054f6b198648a4e1edcef71d8cfc0907bb775bc
This commit is contained in:
Sidney Shiba 2020-10-23 17:22:24 -05:00
parent 81efbceea6
commit ad0e87ea88
2 changed files with 34 additions and 0 deletions

View File

@ -37,6 +37,8 @@ const (
ClusterctlType
// IsogenType event emitted by Isogen executor
IsogenType
// BootstrapType event emitted by Bootstrap executor
BootstrapType
)
// Event holds all possible events that can be produced by airship
@ -48,6 +50,7 @@ type Event struct {
StatusPollerEvent statuspollerevent.Event
ClusterctlEvent ClusterctlEvent
IsogenEvent IsogenEvent
BootstrapEvent BootstrapEvent
}
// NewEvent create new event with timestamp
@ -120,3 +123,32 @@ func (e Event) WithIsogenEvent(concreteEvent IsogenEvent) Event {
e.IsogenEvent = concreteEvent
return e
}
// BootstrapOperation type
type BootstrapOperation int
const (
// BootstrapStart operation
BootstrapStart BootstrapOperation = iota
// BootstrapDryRun operation
BootstrapDryRun
// BootstrapValidation operation
BootstrapValidation
// BootstrapRun operation
BootstrapRun
// BootstrapEnd operation
BootstrapEnd
)
// BootstrapEvent needs to to track events in bootstrap executor
type BootstrapEvent struct {
Operation BootstrapOperation
Message string
}
// WithBootstrapEvent sets type and actual bootstrap event
func (e Event) WithBootstrapEvent(concreteEvent BootstrapEvent) Event {
e.Type = BootstrapType
e.BootstrapEvent = concreteEvent
return e
}

View File

@ -59,6 +59,8 @@ func (p *DefaultProcessor) Process(ch <-chan Event) error {
// Stringer interface or AsYAML for further processing.
// For now we print the event object as is
log.Printf("Received event: %v", e)
case BootstrapType:
log.Printf("%s", e.BootstrapEvent.Message)
case StatusPollerType:
log.Fatalf("Processing for status poller events are not yet implemented")
case WaitType: