github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/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/lib/cgutil" 12 "github.com/hashicorp/nomad/client/pluginmanager/csimanager" 13 "github.com/hashicorp/nomad/client/pluginmanager/drivermanager" 14 "github.com/hashicorp/nomad/client/serviceregistration" 15 "github.com/hashicorp/nomad/client/serviceregistration/checks/checkstore" 16 "github.com/hashicorp/nomad/client/serviceregistration/wrapper" 17 cstate "github.com/hashicorp/nomad/client/state" 18 "github.com/hashicorp/nomad/client/vaultclient" 19 "github.com/hashicorp/nomad/nomad/structs" 20 ) 21 22 // Config holds the configuration for creating an allocation runner. 23 type Config struct { 24 // Logger is the logger for the allocation runner. 25 Logger log.Logger 26 27 // ClientConfig is the clients configuration. 28 ClientConfig *clientconfig.Config 29 30 // Alloc captures the allocation that should be run. 31 Alloc *structs.Allocation 32 33 // StateDB is used to store and restore state. 34 StateDB cstate.StateDB 35 36 // Consul is the Consul client used to register task services and checks 37 Consul serviceregistration.Handler 38 39 // ConsulProxies is the Consul client used to lookup supported envoy versions 40 // of the Consul agent. 41 ConsulProxies consul.SupportedProxiesAPI 42 43 // ConsulSI is the Consul client used to manage service identity tokens. 44 ConsulSI consul.ServiceIdentityAPI 45 46 // Vault is the Vault client to use to retrieve Vault tokens 47 Vault vaultclient.VaultClient 48 49 // StateUpdater is used to emit updated task state 50 StateUpdater interfaces.AllocStateHandler 51 52 // DeviceStatsReporter is used to lookup resource usage for alloc devices 53 DeviceStatsReporter interfaces.DeviceStatsReporter 54 55 // PrevAllocWatcher handles waiting on previous or preempted allocations 56 PrevAllocWatcher allocwatcher.PrevAllocWatcher 57 58 // PrevAllocMigrator allows the migration of a previous allocations alloc dir 59 PrevAllocMigrator allocwatcher.PrevAllocMigrator 60 61 // DynamicRegistry contains all locally registered dynamic plugins (e.g csi 62 // plugins). 63 DynamicRegistry dynamicplugins.Registry 64 65 // CSIManager is used to wait for CSI Volumes to be attached, and by the task 66 // runner to manage their mounting 67 CSIManager csimanager.Manager 68 69 // DeviceManager is used to mount devices as well as lookup device 70 // statistics 71 DeviceManager devicemanager.Manager 72 73 // DriverManager handles dispensing of driver plugins 74 DriverManager drivermanager.Manager 75 76 // CpusetManager configures the cpuset cgroup if supported by the platform 77 CpusetManager cgutil.CpusetManager 78 79 // ServersContactedCh is closed when the first GetClientAllocs call to 80 // servers succeeds and allocs are synced. 81 ServersContactedCh chan struct{} 82 83 // RPCClient is the RPC Client that should be used by the allocrunner and its 84 // hooks to communicate with Nomad Servers. 85 RPCClient RPCer 86 87 // ServiceRegWrapper is the handler wrapper that is used by service hooks 88 // to perform service and check registration and deregistration. 89 ServiceRegWrapper *wrapper.HandlerWrapper 90 91 // CheckStore contains check result information. 92 CheckStore checkstore.Shim 93 94 // Getter is an interface for retrieving artifacts. 95 Getter interfaces.ArtifactGetter 96 }