nomad

package
v0.5.61 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Nomad

type Nomad interface {
	// SetConfig for the client, path is a valid Nomad JSON config file
	SetConfig(address string, port, nodes int) error
	// Create jobs in the provided files
	Create(files []string) error
	// Stop jobs in the provided files
	Stop(files []string) error
	// ParseJob in the given file and return a JSON blob representing the HCL job
	ParseJob(file string) ([]byte, error)
	// JobRunning returns true if all allocations for a job are running
	JobRunning(job string) (bool, error)
	// HealthCheckAPI uses the Nomad API to check that all servers and nodes
	// are ready. The function will block until either all nodes are healthy or the
	// timeout period elapses.
	HealthCheckAPI(time.Duration) error
	// Endpoints returns a list of endpoints for a cluster
	Endpoints(job, group, task string) ([]map[string]string, error)
}

Nomad defines an interface for a Nomad client

func NewNomad

func NewNomad(c chttp.HTTP, backoff time.Duration, l logger.Logger) Nomad

NewNomad creates a new Nomad client

type NomadImpl

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

NomadImpl is an implementation of the Nomad interface

func (*NomadImpl) Create

func (n *NomadImpl) Create(files []string) error

Create jobs in the Nomad cluster for the given files and wait until all jobs are running

func (*NomadImpl) Endpoints

func (n *NomadImpl) Endpoints(job, group, task string) ([]map[string]string, error)

Endpoints returns a list of endpoints for a cluster

func (*NomadImpl) HealthCheckAPI

func (n *NomadImpl) HealthCheckAPI(timeout time.Duration) error

HealthCheckAPI executes a HTTP heath check for a Nomad cluster

func (*NomadImpl) JobRunning

func (n *NomadImpl) JobRunning(job string) (bool, error)

JobRunning returns true when all allocations for a job are running

func (*NomadImpl) ParseJob

func (n *NomadImpl) ParseJob(file string) ([]byte, error)

ParseJob validates a HCL job file with the Nomad API and returns a slice of bytes representing the JSON payload.

func (*NomadImpl) SetConfig

func (n *NomadImpl) SetConfig(address string, port, nodes int) error

SetConfig loads the Nomad config from a file

func (*NomadImpl) Stop

func (n *NomadImpl) Stop(files []string) error

Stop the jobs defined in the files for the referenced Nomad cluster

Jump to

Keyboard shortcuts

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