orchestrator

package
v0.0.0-...-11464cf Latest Latest
Warning

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

Go to latest
Published: May 9, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingApplications is returned when no applications
	// have been configured for the orchestrator
	ErrMissingApplications = errors.New("missing applications")

	// ErrMissingGatherTimeout is returned when no scatter-
	// gather timeout has been configured.
	ErrMissingGatherTimeout = errors.New("missing gather timeout")

	// ErrInvalidGatherChanSize is returned when no scatter-
	// gather channel size has been configured.
	ErrInvalidGatherChanSize = errors.New("gather channel size must be greater than zero")
)

Functions

This section is empty.

Types

type Application

type Application struct {
	Name       string  `json:"name"`
	Schedule   string  `json:"schedule"`
	Percentage float64 `json:"percentage"`
}

Application represents an application the Orchestrator can kill.

type Applications

type Applications []Application

Applications is a slice of Application structs.

type Config

type Config struct {
	NatsHosts      []string             `json:"natsHosts"`
	NatsUser       string               `json:"natsUser"`
	NatsPass       string               `json:"natsPass"`
	GatherTimeout  model.ConfigDuration `json:"gatherTimeout"`
	GatherChanSize int                  `json:"gatherChanSize"`

	LogLevel model.ConfigLogLevel `json:"logLevel"`

	Applications Applications `json:"applications"`
}

Config holds the configuration variables an orchestrator needs to run.

func NewConfigFromReader

func NewConfigFromReader(reader io.Reader) (c *Config, err error)

NewConfigFromReader loads Orchestrator configuration from a given file path and returns any errors encountered.

func (*Config) Validate

func (c *Config) Validate() (err error)

Validate performs basic config-time validation.

type Orchestrator

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

Orchestrator holds the necessary information to process Application instances.

func NewOrchestrator

func NewOrchestrator(c *Config, processor Processor, logger *logrus.Logger) (o *Orchestrator, err error)

NewOrchestrator returns a pointer to a new instance of an Orchestrator.

func (*Orchestrator) Process

func (o *Orchestrator) Process(a Application)

Process makes a request for Applications and the performs a set of kill operations on them.

func (*Orchestrator) Start

func (o *Orchestrator) Start()

Start begins a number of jobs to process each of the applications configured in the Orchestrator's config file. NOTE: Needs to be run in a goroutine

func (*Orchestrator) Stop

func (o *Orchestrator) Stop()

Stop tears down the Orchestrator.

type Processor

type Processor interface {
	Gather(application string) (resps []string, err error)
	IssueKill(topic string) (err error)
}

Processor defines the communicative behaviour of an Orchestrator.

Jump to

Keyboard shortcuts

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