e42154fc46
* Stopping an alloc is implemented via Updates but update hooks are *not* run. * Destroying an alloc is a best effort cleanup. * AllocRunner destroy hooks implemented. * Disk migration and blocking on a previous allocation exiting moved to its own package to avoid cycles. Now only depends on alloc broadcaster instead of also using a waitch. * AllocBroadcaster now only drops stale allocations and always keeps the latest version. * Made AllocDir safe for concurrent use Lots of internal contexts that are currently unused. Unsure if they should be used or removed.
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package allocrunnerv2
|
|
|
|
import (
|
|
log "github.com/hashicorp/go-hclog"
|
|
"github.com/hashicorp/nomad/client/allocwatcher"
|
|
clientconfig "github.com/hashicorp/nomad/client/config"
|
|
"github.com/hashicorp/nomad/client/consul"
|
|
"github.com/hashicorp/nomad/client/interfaces"
|
|
cstate "github.com/hashicorp/nomad/client/state"
|
|
"github.com/hashicorp/nomad/client/vaultclient"
|
|
"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
|
|
|
|
// Alloc captures the allocation that should be run.
|
|
Alloc *structs.Allocation
|
|
|
|
// StateDB is used to store and restore state.
|
|
StateDB cstate.StateDB
|
|
|
|
// Consul is the Consul client used to register task services and checks
|
|
Consul consul.ConsulServiceAPI
|
|
|
|
// Vault is the Vault client to use to retrieve Vault tokens
|
|
Vault vaultclient.VaultClient
|
|
|
|
// StateUpdater is used to emit updated task state
|
|
StateUpdater interfaces.AllocStateHandler
|
|
|
|
// PrevAllocWatcher handles waiting on previous allocations and
|
|
// migrating their ephemeral disk when necessary.
|
|
PrevAllocWatcher allocwatcher.PrevAllocWatcher
|
|
}
|