github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/client/allocrunner/config.go (about) 1 package allocrunner 2 3 import ( 4 log "github.com/hashicorp/go-hclog" 5 "github.com/hashicorp/nomad/client/allocwatcher" 6 clientconfig "github.com/hashicorp/nomad/client/config" 7 "github.com/hashicorp/nomad/client/consul" 8 "github.com/hashicorp/nomad/client/devicemanager" 9 "github.com/hashicorp/nomad/client/dynamicplugins" 10 "github.com/hashicorp/nomad/client/interfaces" 11 "github.com/hashicorp/nomad/client/pluginmanager/csimanager" 12 "github.com/hashicorp/nomad/client/pluginmanager/drivermanager" 13 cstate "github.com/hashicorp/nomad/client/state" 14 "github.com/hashicorp/nomad/client/vaultclient" 15 "github.com/hashicorp/nomad/nomad/structs" 16 ) 17 18 // Config holds the configuration for creating an allocation runner. 19 type Config struct { 20 // Logger is the logger for the allocation runner. 21 Logger log.Logger 22 23 // ClientConfig is the clients configuration. 24 ClientConfig *clientconfig.Config 25 26 // Alloc captures the allocation that should be run. 27 Alloc *structs.Allocation 28 29 // StateDB is used to store and restore state. 30 StateDB cstate.StateDB 31 32 // Consul is the Consul client used to register task services and checks 33 Consul consul.ConsulServiceAPI 34 35 // ConsulProxies is the Consul client used to lookup supported envoy versions 36 // of the Consul agent. 37 ConsulProxies consul.SupportedProxiesAPI 38 39 // ConsulSI is the Consul client used to manage service identity tokens. 40 ConsulSI consul.ServiceIdentityAPI 41 42 // Vault is the Vault client to use to retrieve Vault tokens 43 Vault vaultclient.VaultClient 44 45 // StateUpdater is used to emit updated task state 46 StateUpdater interfaces.AllocStateHandler 47 48 // DeviceStatsReporter is used to lookup resource usage for alloc devices 49 DeviceStatsReporter interfaces.DeviceStatsReporter 50 51 // PrevAllocWatcher handles waiting on previous or preempted allocations 52 PrevAllocWatcher allocwatcher.PrevAllocWatcher 53 54 // PrevAllocMigrator allows the migration of a previous allocations alloc dir 55 PrevAllocMigrator allocwatcher.PrevAllocMigrator 56 57 // DynamicRegistry contains all locally registered dynamic plugins (e.g csi 58 // plugins). 59 DynamicRegistry dynamicplugins.Registry 60 61 // CSIManager is used to wait for CSI Volumes to be attached, and by the task 62 // runner to manage their mounting 63 CSIManager csimanager.Manager 64 65 // DeviceManager is used to mount devices as well as lookup device 66 // statistics 67 DeviceManager devicemanager.Manager 68 69 // DriverManager handles dispensing of driver plugins 70 DriverManager drivermanager.Manager 71 72 // ServersContactedCh is closed when the first GetClientAllocs call to 73 // servers succeeds and allocs are synced. 74 ServersContactedCh chan struct{} 75 76 // RPCClient is the RPC Client that should be used by the allocrunner and its 77 // hooks to communicate with Nomad Servers. 78 RPCClient RPCer 79 }