allocrunner

package
v0.0.0-...-7f4d9b3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2025 License: MPL-2.0 Imports: 59 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFailHookError = errors.New("failed successfully")

Functions

func NewAllocRunner

func NewAllocRunner(config *config.AllocRunnerConfig) (interfaces.AllocRunner, error)

NewAllocRunner returns a new allocation runner.

func TestAllocRunnerFromAlloc

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

func WaitForClientState

func WaitForClientState(t *testing.T, ar interfaces.AllocRunner, state string)

Types

type FailHook

type FailHook struct {
	Fail struct {
		Prerun         bool `hcl:"prerun,optional"`
		PreKill        bool `hcl:"prekill,optional"`
		Postrun        bool `hcl:"postrun,optional"`
		Destroy        bool `hcl:"destroy,optional"`
		Update         bool `hcl:"update,optional"`
		PreTaskRestart bool `hcl:"pretaskrestart,optional"`
		Shutdown       bool `hcl:"shutdown,optional"`
	}
	// contains filtered or unexported fields
}

func NewFailHook

func NewFailHook(l hclog.Logger, name string) *FailHook

func (*FailHook) Destroy

func (h *FailHook) Destroy() error

func (*FailHook) LoadConfig

func (h *FailHook) LoadConfig(path string) *FailHook

func (*FailHook) Name

func (h *FailHook) Name() string

func (*FailHook) Postrun

func (h *FailHook) Postrun() error

func (*FailHook) PreKill

func (h *FailHook) PreKill()

func (*FailHook) PreTaskRestart

func (h *FailHook) PreTaskRestart() error

func (*FailHook) Prerun

func (h *FailHook) Prerun() error

func (*FailHook) Shutdown

func (h *FailHook) Shutdown()

func (*FailHook) Update

func (h *FailHook) Update(request *interfaces.RunnerUpdateRequest) error

type IPTables

type IPTables interface {
	List(table, chain string) ([]string, error)
	Delete(table, chain string, rule ...string) error
	ClearAndDeleteChain(table, chain string) error
}

IPTables is a subset of iptables.IPTables

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) PutAllocation

func (m *MockStateUpdater) PutAllocation(alloc *structs.Allocation) (err error)

PutAllocation satisfies the AllocStateHandler interface.

func (*MockStateUpdater) Reset

func (m *MockStateUpdater) Reset()

Reset resets the recorded alloc updates.

type NetworkConfigurator

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

Directories

Path Synopsis
Package tasklifecycle manages the execution order of tasks based on their lifecycle configuration.
Package tasklifecycle manages the execution order of tasks based on their lifecycle configuration.

Jump to

Keyboard shortcuts

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