nomadWorker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MaxInt = int(MaxUint >> 1)
View Source
const MaxUint = ^uint(0)

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

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

Connector is a object that allows to interact with nomad worker

func New added in v0.0.10

func New(nomadServerAddress, awsProfile string, options ...Option) (*Connector, error)

New creates a new nomad worker connector. The profile represents the name of the aws profile that shall be used to access the resources to scale the aws AutoScalingGroup. This parameter is optional. If the profile is NOT set the instance where sokar runs on has to have enough permissions to access the resources (ASG) for scaling (e.g. granted by a AWS Instance Profile). In this case the region parameter has to be specified instead (via WithAwsRegion()).

func (*Connector) AdjustScalingObjectCount added in v0.0.9

func (c *Connector) AdjustScalingObjectCount(datacenter string, min uint, max uint, from uint, to uint) error

AdjustScalingObjectCount will scale the nomad workers to the desired count (amount of instances)

func (*Connector) GetScalingObjectCount

func (c *Connector) GetScalingObjectCount(datacenter string) (uint, error)

GetScalingObjectCount will return the count of the nomad workers

func (*Connector) IsScalingObjectDead

func (c *Connector) IsScalingObjectDead(datacenter string) (bool, error)

IsScalingObjectDead will return if the nomad workers of the actual data-center are still available.

func (*Connector) String added in v0.0.9

func (c *Connector) String() string

type Nodes added in v0.0.9

type Nodes interface {
	List(q *nomadApi.QueryOptions) ([]*nomadApi.NodeListStub, *nomadApi.QueryMeta, error)
	ToggleEligibility(nodeID string, eligible bool, q *nomadApi.WriteOptions) (*nomadApi.NodeEligibilityUpdateResponse, error)
	UpdateDrain(nodeID string, spec *nomadApi.DrainSpec, markEligible bool, q *nomadApi.WriteOptions) (*nomadApi.NodeDrainUpdateResponse, error)
	MonitorDrain(ctx context.Context, nodeID string, index uint64, ignoreSys bool) <-chan *nomadApi.MonitorMessage
	Allocations(nodeID string, q *nomadApi.QueryOptions) ([]*nomadApi.Allocation, *nomadApi.QueryMeta, error)
}

Nodes represents the minimal interface used to gather information about nomad nodes

type Option added in v0.0.10

type Option func(c *Connector)

Option represents an option for the nomadWorker Connector

func TimeoutForInstanceTermination added in v0.0.11

func TimeoutForInstanceTermination(timeout time.Duration) Option

TimeoutForInstanceTermination sets the maximum time the instance termination will be monitored before assuming that this action failed.

func WithAwsRegion added in v0.0.10

func WithAwsRegion(region string) Option

WithAwsRegion sets the aws region in which the resource to be scaled can be found

func WithLogger added in v0.0.10

func WithLogger(logger zerolog.Logger) Option

WithLogger adds a configured Logger to the nomadWorker Connector

Jump to

Keyboard shortcuts

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