Documentation ¶
Index ¶
- func NewAllocRunner(config *Config) (*allocRunner, error)
- func TestAllocRunnerFromAlloc(t *testing.T, alloc *structs.Allocation) (*allocRunner, func())
- func WaitForClientState(t *testing.T, ar *allocRunner, state string)
- type Config
- type IPTables
- type MockStateUpdater
- type NetworkConfigurator
- type RPCer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAllocRunner ¶
NewAllocRunner returns a new allocation runner.
func TestAllocRunnerFromAlloc ¶
func TestAllocRunnerFromAlloc(t *testing.T, alloc *structs.Allocation) (*allocRunner, func())
func WaitForClientState ¶
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 serviceregistration.Handler // ConsulProxies is the Consul client used to lookup supported envoy versions // of the Consul agent. ConsulProxies consul.SupportedProxiesAPI // 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 // DynamicRegistry contains all locally registered dynamic plugins (e.g csi // plugins). DynamicRegistry dynamicplugins.Registry // CSIManager is used to wait for CSI Volumes to be attached, and by the task // runner to manage their mounting CSIManager csimanager.Manager // DeviceManager is used to mount devices as well as lookup device // statistics DeviceManager devicemanager.Manager // DriverManager handles dispensing of driver plugins DriverManager drivermanager.Manager // CpusetManager configures the cpuset cgroup if supported by the platform CpusetManager cgutil.CpusetManager // ServersContactedCh is closed when the first GetClientAllocs call to // servers succeeds and allocs are synced. ServersContactedCh chan struct{} // RPCClient is the RPC Client that should be used by the allocrunner and its // hooks to communicate with Nomad Servers. RPCClient RPCer // ServiceRegWrapper is the handler wrapper that is used by service hooks // to perform service and check registration and deregistration. ServiceRegWrapper *wrapper.HandlerWrapper // CheckStore contains check result information. CheckStore checkstore.Shim // Getter is an interface for retrieving artifacts. Getter interfaces.ArtifactGetter }
Config holds the configuration for creating an allocation runner.
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 ¶
type NetworkConfigurator interface { Setup(context.Context, *structs.Allocation, *drivers.NetworkIsolationSpec) (*structs.AllocNetworkStatus, error) Teardown(context.Context, *structs.Allocation, *drivers.NetworkIsolationSpec) error }
NetworkConfigurator sets up and tears down the interfaces, routes, firewall rules, etc for the configured networking mode of the allocation.
Source Files ¶
- alloc_runner.go
- alloc_runner_hooks.go
- allocdir_hook.go
- cgroup_hook.go
- checks_hook.go
- config.go
- consul_grpc_sock_hook.go
- consul_http_sock_hook.go
- csi_hook.go
- group_service_hook.go
- health_hook.go
- migrate_hook.go
- network_hook.go
- network_manager_linux.go
- networking.go
- networking_bridge_linux.go
- networking_cni.go
- testing.go
- upstream_allocs_hook.go
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. |