github.com/bigcommerce/nomad@v0.9.3-bc/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/interfaces"
    10  	"github.com/hashicorp/nomad/client/pluginmanager/drivermanager"
    11  	cstate "github.com/hashicorp/nomad/client/state"
    12  	"github.com/hashicorp/nomad/client/vaultclient"
    13  	"github.com/hashicorp/nomad/nomad/structs"
    14  )
    15  
    16  // Config holds the configuration for creating an allocation runner.
    17  type Config struct {
    18  	// Logger is the logger for the allocation runner.
    19  	Logger log.Logger
    20  
    21  	// ClientConfig is the clients configuration.
    22  	ClientConfig *clientconfig.Config
    23  
    24  	// Alloc captures the allocation that should be run.
    25  	Alloc *structs.Allocation
    26  
    27  	// StateDB is used to store and restore state.
    28  	StateDB cstate.StateDB
    29  
    30  	// Consul is the Consul client used to register task services and checks
    31  	Consul consul.ConsulServiceAPI
    32  
    33  	// Vault is the Vault client to use to retrieve Vault tokens
    34  	Vault vaultclient.VaultClient
    35  
    36  	// StateUpdater is used to emit updated task state
    37  	StateUpdater interfaces.AllocStateHandler
    38  
    39  	// DeviceStatsReporter is used to lookup resource usage for alloc devices
    40  	DeviceStatsReporter interfaces.DeviceStatsReporter
    41  
    42  	// PrevAllocWatcher handles waiting on previous or preempted allocations
    43  	PrevAllocWatcher allocwatcher.PrevAllocWatcher
    44  
    45  	// PrevAllocMigrator allows the migration of a previous allocations alloc dir
    46  	PrevAllocMigrator allocwatcher.PrevAllocMigrator
    47  
    48  	// DeviceManager is used to mount devices as well as lookup device
    49  	// statistics
    50  	DeviceManager devicemanager.Manager
    51  
    52  	// DriverManager handles dispensing of driver plugins
    53  	DriverManager drivermanager.Manager
    54  
    55  	// ServersContactedCh is closed when the first GetClientAllocs call to
    56  	// servers succeeds and allocs are synced.
    57  	ServersContactedCh chan struct{}
    58  }