2018-10-04 23:22:01 +00:00
|
|
|
package allocrunner
|
2018-06-22 00:35:07 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
log "github.com/hashicorp/go-hclog"
|
2018-08-23 19:03:17 +00:00
|
|
|
"github.com/hashicorp/nomad/client/allocwatcher"
|
2018-06-22 00:35:07 +00:00
|
|
|
clientconfig "github.com/hashicorp/nomad/client/config"
|
2018-07-20 00:40:25 +00:00
|
|
|
"github.com/hashicorp/nomad/client/consul"
|
2018-11-16 23:29:59 +00:00
|
|
|
"github.com/hashicorp/nomad/client/devicemanager"
|
2019-10-22 13:20:26 +00:00
|
|
|
"github.com/hashicorp/nomad/client/dynamicplugins"
|
2018-07-19 00:06:44 +00:00
|
|
|
"github.com/hashicorp/nomad/client/interfaces"
|
2018-11-28 03:42:22 +00:00
|
|
|
"github.com/hashicorp/nomad/client/pluginmanager/drivermanager"
|
2018-08-08 00:46:37 +00:00
|
|
|
cstate "github.com/hashicorp/nomad/client/state"
|
2018-07-12 23:15:33 +00:00
|
|
|
"github.com/hashicorp/nomad/client/vaultclient"
|
2018-06-22 00:35:07 +00:00
|
|
|
"github.com/hashicorp/nomad/nomad/structs"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Config holds the configuration for creating an allocation runner.
|
|
|
|
type Config struct {
|
|
|
|
// Logger is the logger for the allocation runner.
|
|
|
|
Logger log.Logger
|
|
|
|
|
|
|
|
// ClientConfig is the clients configuration.
|
|
|
|
ClientConfig *clientconfig.Config
|
|
|
|
|
2018-06-29 00:01:05 +00:00
|
|
|
// Alloc captures the allocation that should be run.
|
|
|
|
Alloc *structs.Allocation
|
2018-06-22 00:35:07 +00:00
|
|
|
|
|
|
|
// StateDB is used to store and restore state.
|
2018-08-08 00:46:37 +00:00
|
|
|
StateDB cstate.StateDB
|
2018-06-22 00:35:07 +00:00
|
|
|
|
2018-07-20 00:40:25 +00:00
|
|
|
// Consul is the Consul client used to register task services and checks
|
|
|
|
Consul consul.ConsulServiceAPI
|
|
|
|
|
2019-11-27 21:41:45 +00:00
|
|
|
// ConsulSI is the Consul client used to manage service identity tokens.
|
|
|
|
ConsulSI consul.ServiceIdentityAPI
|
|
|
|
|
2018-07-12 23:15:33 +00:00
|
|
|
// Vault is the Vault client to use to retrieve Vault tokens
|
|
|
|
Vault vaultclient.VaultClient
|
|
|
|
|
2018-07-19 00:06:44 +00:00
|
|
|
// StateUpdater is used to emit updated task state
|
|
|
|
StateUpdater interfaces.AllocStateHandler
|
2018-08-23 19:03:17 +00:00
|
|
|
|
2018-12-06 11:15:59 +00:00
|
|
|
// DeviceStatsReporter is used to lookup resource usage for alloc devices
|
2018-11-15 15:13:14 +00:00
|
|
|
DeviceStatsReporter interfaces.DeviceStatsReporter
|
|
|
|
|
2018-12-06 11:15:59 +00:00
|
|
|
// PrevAllocWatcher handles waiting on previous or preempted allocations
|
2018-08-23 19:03:17 +00:00
|
|
|
PrevAllocWatcher allocwatcher.PrevAllocWatcher
|
2018-10-04 19:08:20 +00:00
|
|
|
|
2018-12-06 11:15:59 +00:00
|
|
|
// PrevAllocMigrator allows the migration of a previous allocations alloc dir
|
|
|
|
PrevAllocMigrator allocwatcher.PrevAllocMigrator
|
2018-12-05 18:18:04 +00:00
|
|
|
|
2019-10-22 13:20:26 +00:00
|
|
|
// DynamicRegistry contains all locally registered dynamic plugins (e.g csi
|
|
|
|
// plugins).
|
|
|
|
DynamicRegistry dynamicplugins.Registry
|
|
|
|
|
2018-11-16 23:29:59 +00:00
|
|
|
// DeviceManager is used to mount devices as well as lookup device
|
|
|
|
// statistics
|
|
|
|
DeviceManager devicemanager.Manager
|
2018-11-28 03:42:22 +00:00
|
|
|
|
|
|
|
// DriverManager handles dispensing of driver plugins
|
|
|
|
DriverManager drivermanager.Manager
|
2019-05-10 15:51:06 +00:00
|
|
|
|
|
|
|
// ServersContactedCh is closed when the first GetClientAllocs call to
|
|
|
|
// servers succeeds and allocs are synced.
|
|
|
|
ServersContactedCh chan struct{}
|
2018-06-22 00:35:07 +00:00
|
|
|
}
|