allocrunner

package
v0.10.8 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MPL-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAllocRunner

func NewAllocRunner(config *Config) (*allocRunner, error)

NewAllocRunner returns a new allocation runner.

func TestAllocRunnerFromAlloc

func TestAllocRunnerFromAlloc(t *testing.T, alloc *structs.Allocation) (*allocRunner, func())

Types

type Config

type Config struct {
	// Logger is the logger for the allocation runner.
	Logger log.Logger

	// ClientConfig is the clients configuration.
	ClientConfig *clientconfig.Config

	// Alloc captures the allocation that should be run.
	Alloc *structs.Allocation

	// StateDB is used to store and restore state.
	StateDB cstate.StateDB

	// Consul is the Consul client used to register task services and checks
	Consul consul.ConsulServiceAPI

	// ConsulSI is the Consul client used to manage service identity tokens.
	ConsulSI consul.ServiceIdentityAPI

	// Vault is the Vault client to use to retrieve Vault tokens
	Vault vaultclient.VaultClient

	// StateUpdater is used to emit updated task state
	StateUpdater interfaces.AllocStateHandler

	// DeviceStatsReporter is used to lookup resource usage for alloc devices
	DeviceStatsReporter interfaces.DeviceStatsReporter

	// PrevAllocWatcher handles waiting on previous or preempted allocations
	PrevAllocWatcher allocwatcher.PrevAllocWatcher

	// PrevAllocMigrator allows the migration of a previous allocations alloc dir
	PrevAllocMigrator allocwatcher.PrevAllocMigrator

	// DeviceManager is used to mount devices as well as lookup device
	// statistics
	DeviceManager devicemanager.Manager

	// DriverManager handles dispensing of driver plugins
	DriverManager drivermanager.Manager

	// ServersContactedCh is closed when the first GetClientAllocs call to
	// servers succeeds and allocs are synced.
	ServersContactedCh chan struct{}
}

Config holds the configuration for creating an allocation runner.

type MockStateUpdater

type MockStateUpdater struct {
	Updates []*structs.Allocation
	// contains filtered or unexported fields
}

MockStateUpdater implements the AllocStateHandler interface and records alloc updates.

func (*MockStateUpdater) AllocStateUpdated

func (m *MockStateUpdater) AllocStateUpdated(alloc *structs.Allocation)

AllocStateUpdated implements the AllocStateHandler interface and records an alloc update.

func (*MockStateUpdater) Last

func (m *MockStateUpdater) Last() *structs.Allocation

Last returns a copy of the last alloc (or nil) update. Safe for concurrent access with updates.

func (*MockStateUpdater) Reset

func (m *MockStateUpdater) Reset()

Reset resets the recorded alloc updates.

type NetworkConfigurator added in v0.10.0

NetworkConfigurator sets up and tears down the interfaces, routes, firewall rules, etc for the configured networking mode of the allocation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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