github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/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  	// ConsulSI is the Consul client used to manage service identity tokens.
    36  	ConsulSI consul.ServiceIdentityAPI
    37  
    38  	// Vault is the Vault client to use to retrieve Vault tokens
    39  	Vault vaultclient.VaultClient
    40  
    41  	// StateUpdater is used to emit updated task state
    42  	StateUpdater interfaces.AllocStateHandler
    43  
    44  	// DeviceStatsReporter is used to lookup resource usage for alloc devices
    45  	DeviceStatsReporter interfaces.DeviceStatsReporter
    46  
    47  	// PrevAllocWatcher handles waiting on previous or preempted allocations
    48  	PrevAllocWatcher allocwatcher.PrevAllocWatcher
    49  
    50  	// PrevAllocMigrator allows the migration of a previous allocations alloc dir
    51  	PrevAllocMigrator allocwatcher.PrevAllocMigrator
    52  
    53  	// DynamicRegistry contains all locally registered dynamic plugins (e.g csi
    54  	// plugins).
    55  	DynamicRegistry dynamicplugins.Registry
    56  
    57  	// CSIManager is used to wait for CSI Volumes to be attached, and by the task
    58  	// runner to manage their mounting
    59  	CSIManager csimanager.Manager
    60  
    61  	// DeviceManager is used to mount devices as well as lookup device
    62  	// statistics
    63  	DeviceManager devicemanager.Manager
    64  
    65  	// DriverManager handles dispensing of driver plugins
    66  	DriverManager drivermanager.Manager
    67  
    68  	// ServersContactedCh is closed when the first GetClientAllocs call to
    69  	// servers succeeds and allocs are synced.
    70  	ServersContactedCh chan struct{}
    71  
    72  	// RPCClient is the RPC Client that should be used by the allocrunner and its
    73  	// hooks to communicate with Nomad Servers.
    74  	RPCClient RPCer
    75  }