nomad

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: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	NomadServerAddress string
	Logger             zerolog.Logger

	// DeploymentTimeOut reflects the timeout sokar will wait (at max) for a deployment to be applied.
	DeploymentTimeOut time.Duration
	// EvaluationTimeOut reflects the timeout sokar will wait (at max) for gathering information about evaluations.
	EvaluationTimeOut time.Duration
}

Config contains the main configuration for the nomad connector

type Connector

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

Connector is a object that allows to interact with nomad

func New added in v0.0.10

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

New creates a new nomad connector

Example
conn, err := New("http://1.2.3.4")

if err != nil {
	log.Fatalf("Unable to create connector: %s.", err.Error())
}

// just to avoid the not used error
_ = conn
Output:

func (*Connector) AdjustScalingObjectCount added in v0.0.9

func (nc *Connector) AdjustScalingObjectCount(jobname string, min uint, max uint, from uint, to uint) error

AdjustScalingObjectCount sets the given count for the given nomad job. HACK: The count is set to the same value for all groups inside the job.

func (*Connector) GetScalingObjectCount

func (nc *Connector) GetScalingObjectCount(jobname string) (uint, error)

GetScalingObjectCount retunrs the actual count of the given nomad job. HACK: To unify the multiple groups with we take the job with max count.

func (*Connector) IsScalingObjectDead

func (nc *Connector) IsScalingObjectDead(jobname string) (bool, error)

IsScalingObjectDead returns true if the mentioned job is in state nomad./structs/JobStatusDead, false otherwise.

func (*Connector) String added in v0.0.9

func (c *Connector) String() string

type Deployments

type Deployments interface {
	Info(deploymentID string, q *nomadApi.QueryOptions) (*nomadApi.Deployment, *nomadApi.QueryMeta, error)
}

Deployments represents the interface for interacting with nomads over the deployments end-point

type Evaluations

type Evaluations interface {
	Info(evalID string, q *nomadApi.QueryOptions) (*nomadApi.Evaluation, *nomadApi.QueryMeta, error)
}

Evaluations represents the interface for interacting with nomads over the evaluations end-point

type Jobs

Jobs represents the interface for interacting with nomads over the jobs end-point

type Option added in v0.0.10

type Option func(conn *Connector)

Option represents an option for the Connector

func WithDeploymentTimeOut added in v0.0.10

func WithDeploymentTimeOut(timeout time.Duration) Option

WithDeploymentTimeOut sets the timeout that should be regarded during deployments

func WithEvaluationTimeOut added in v0.0.10

func WithEvaluationTimeOut(timeout time.Duration) Option

WithEvaluationTimeOut sets the timeout that should be regarded during evaluations

func WithLogger added in v0.0.10

func WithLogger(logger zerolog.Logger) Option

WithLogger adds a configured Logger to the Connector

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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