Merge branch 'master' of github.com:hashicorp/nomad
This commit is contained in:
commit
2143d1cd26
|
@ -1,4 +1,4 @@
|
||||||
## 0.3.0 (UNRELEASED)
|
## 0.3.0
|
||||||
|
|
||||||
__BACKWARDS INCOMPATIBILITIES:__
|
__BACKWARDS INCOMPATIBILITIES:__
|
||||||
* Stdout and Stderr log files of tasks have moved from task/local to
|
* Stdout and Stderr log files of tasks have moved from task/local to
|
||||||
|
|
|
@ -66,6 +66,7 @@ type AllocRunner struct {
|
||||||
|
|
||||||
// allocRunnerState is used to snapshot the state of the alloc runner
|
// allocRunnerState is used to snapshot the state of the alloc runner
|
||||||
type allocRunnerState struct {
|
type allocRunnerState struct {
|
||||||
|
Version string
|
||||||
Alloc *structs.Allocation
|
Alloc *structs.Allocation
|
||||||
AllocClientStatus string
|
AllocClientStatus string
|
||||||
AllocClientDescription string
|
AllocClientDescription string
|
||||||
|
@ -181,6 +182,7 @@ func (r *AllocRunner) saveAllocRunnerState() error {
|
||||||
r.ctxLock.Unlock()
|
r.ctxLock.Unlock()
|
||||||
|
|
||||||
snap := allocRunnerState{
|
snap := allocRunnerState{
|
||||||
|
Version: r.config.Version,
|
||||||
Alloc: alloc,
|
Alloc: alloc,
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
AllocClientStatus: allocClientStatus,
|
AllocClientStatus: allocClientStatus,
|
||||||
|
|
|
@ -70,6 +70,9 @@ type Config struct {
|
||||||
//
|
//
|
||||||
// namespace.option = value
|
// namespace.option = value
|
||||||
Options map[string]string
|
Options map[string]string
|
||||||
|
|
||||||
|
// Version is the version of the Nomad client
|
||||||
|
Version string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) Copy() *Config {
|
func (c *Config) Copy() *Config {
|
||||||
|
|
|
@ -74,6 +74,7 @@ func (c *DockerDriverConfig) Validate() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
type dockerPID struct {
|
type dockerPID struct {
|
||||||
|
Version string
|
||||||
ImageID string
|
ImageID string
|
||||||
ContainerID string
|
ContainerID string
|
||||||
KillTimeout time.Duration
|
KillTimeout time.Duration
|
||||||
|
@ -89,6 +90,7 @@ type DockerHandle struct {
|
||||||
cleanupImage bool
|
cleanupImage bool
|
||||||
imageID string
|
imageID string
|
||||||
containerID string
|
containerID string
|
||||||
|
version string
|
||||||
killTimeout time.Duration
|
killTimeout time.Duration
|
||||||
waitCh chan *cstructs.WaitResult
|
waitCh chan *cstructs.WaitResult
|
||||||
doneCh chan struct{}
|
doneCh chan struct{}
|
||||||
|
@ -605,6 +607,7 @@ func (d *DockerDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle
|
||||||
logger: d.logger,
|
logger: d.logger,
|
||||||
imageID: dockerImage.ID,
|
imageID: dockerImage.ID,
|
||||||
containerID: container.ID,
|
containerID: container.ID,
|
||||||
|
version: d.config.Version,
|
||||||
killTimeout: d.DriverContext.KillTimeout(task),
|
killTimeout: d.DriverContext.KillTimeout(task),
|
||||||
doneCh: make(chan struct{}),
|
doneCh: make(chan struct{}),
|
||||||
waitCh: make(chan *cstructs.WaitResult, 1),
|
waitCh: make(chan *cstructs.WaitResult, 1),
|
||||||
|
@ -672,6 +675,7 @@ func (d *DockerDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, er
|
||||||
logger: d.logger,
|
logger: d.logger,
|
||||||
imageID: pid.ImageID,
|
imageID: pid.ImageID,
|
||||||
containerID: pid.ContainerID,
|
containerID: pid.ContainerID,
|
||||||
|
version: pid.Version,
|
||||||
killTimeout: pid.KillTimeout,
|
killTimeout: pid.KillTimeout,
|
||||||
doneCh: make(chan struct{}),
|
doneCh: make(chan struct{}),
|
||||||
waitCh: make(chan *cstructs.WaitResult, 1),
|
waitCh: make(chan *cstructs.WaitResult, 1),
|
||||||
|
@ -683,6 +687,7 @@ func (d *DockerDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, er
|
||||||
func (h *DockerHandle) ID() string {
|
func (h *DockerHandle) ID() string {
|
||||||
// Return a handle to the PID
|
// Return a handle to the PID
|
||||||
pid := dockerPID{
|
pid := dockerPID{
|
||||||
|
Version: h.version,
|
||||||
ImageID: h.imageID,
|
ImageID: h.imageID,
|
||||||
ContainerID: h.containerID,
|
ContainerID: h.containerID,
|
||||||
KillTimeout: h.killTimeout,
|
KillTimeout: h.killTimeout,
|
||||||
|
|
|
@ -152,6 +152,7 @@ func TestDockerDriver_Handle(t *testing.T) {
|
||||||
defer pluginClient.Kill()
|
defer pluginClient.Kill()
|
||||||
|
|
||||||
h := &DockerHandle{
|
h := &DockerHandle{
|
||||||
|
version: "version",
|
||||||
imageID: "imageid",
|
imageID: "imageid",
|
||||||
logCollector: logCollector,
|
logCollector: logCollector,
|
||||||
pluginClient: pluginClient,
|
pluginClient: pluginClient,
|
||||||
|
@ -162,7 +163,7 @@ func TestDockerDriver_Handle(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
actual := h.ID()
|
actual := h.ID()
|
||||||
expected := fmt.Sprintf("DOCKER:{\"ImageID\":\"imageid\",\"ContainerID\":\"containerid\",\"KillTimeout\":5,\"PluginConfig\":{\"Pid\":%d,\"AddrNet\":\"unix\",\"AddrName\":\"%s\"}}",
|
expected := fmt.Sprintf("DOCKER:{\"Version\":\"version\",\"ImageID\":\"imageid\",\"ContainerID\":\"containerid\",\"KillTimeout\":5,\"PluginConfig\":{\"Pid\":%d,\"AddrNet\":\"unix\",\"AddrName\":\"%s\"}}",
|
||||||
pluginClient.ReattachConfig().Pid, pluginClient.ReattachConfig().Addr.String())
|
pluginClient.ReattachConfig().Pid, pluginClient.ReattachConfig().Addr.String())
|
||||||
if actual != expected {
|
if actual != expected {
|
||||||
t.Errorf("Expected `%s`, found `%s`", expected, actual)
|
t.Errorf("Expected `%s`, found `%s`", expected, actual)
|
||||||
|
|
|
@ -45,6 +45,7 @@ type execHandle struct {
|
||||||
logger *log.Logger
|
logger *log.Logger
|
||||||
waitCh chan *cstructs.WaitResult
|
waitCh chan *cstructs.WaitResult
|
||||||
doneCh chan struct{}
|
doneCh chan struct{}
|
||||||
|
version string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewExecDriver is used to create a new exec driver
|
// NewExecDriver is used to create a new exec driver
|
||||||
|
@ -141,6 +142,7 @@ func (d *ExecDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle,
|
||||||
isolationConfig: ps.IsolationConfig,
|
isolationConfig: ps.IsolationConfig,
|
||||||
killTimeout: d.DriverContext.KillTimeout(task),
|
killTimeout: d.DriverContext.KillTimeout(task),
|
||||||
logger: d.logger,
|
logger: d.logger,
|
||||||
|
version: d.config.Version,
|
||||||
doneCh: make(chan struct{}),
|
doneCh: make(chan struct{}),
|
||||||
waitCh: make(chan *cstructs.WaitResult, 1),
|
waitCh: make(chan *cstructs.WaitResult, 1),
|
||||||
}
|
}
|
||||||
|
@ -149,6 +151,7 @@ func (d *ExecDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
type execId struct {
|
type execId struct {
|
||||||
|
Version string
|
||||||
KillTimeout time.Duration
|
KillTimeout time.Duration
|
||||||
UserPid int
|
UserPid int
|
||||||
TaskDir string
|
TaskDir string
|
||||||
|
@ -193,6 +196,7 @@ func (d *ExecDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, erro
|
||||||
allocDir: id.AllocDir,
|
allocDir: id.AllocDir,
|
||||||
isolationConfig: id.IsolationConfig,
|
isolationConfig: id.IsolationConfig,
|
||||||
logger: d.logger,
|
logger: d.logger,
|
||||||
|
version: id.Version,
|
||||||
killTimeout: id.KillTimeout,
|
killTimeout: id.KillTimeout,
|
||||||
doneCh: make(chan struct{}),
|
doneCh: make(chan struct{}),
|
||||||
waitCh: make(chan *cstructs.WaitResult, 1),
|
waitCh: make(chan *cstructs.WaitResult, 1),
|
||||||
|
@ -203,6 +207,7 @@ func (d *ExecDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, erro
|
||||||
|
|
||||||
func (h *execHandle) ID() string {
|
func (h *execHandle) ID() string {
|
||||||
id := execId{
|
id := execId{
|
||||||
|
Version: h.version,
|
||||||
KillTimeout: h.killTimeout,
|
KillTimeout: h.killTimeout,
|
||||||
PluginConfig: NewPluginReattachConfig(h.pluginClient.ReattachConfig()),
|
PluginConfig: NewPluginReattachConfig(h.pluginClient.ReattachConfig()),
|
||||||
UserPid: h.userPid,
|
UserPid: h.userPid,
|
||||||
|
|
|
@ -50,6 +50,7 @@ type javaHandle struct {
|
||||||
taskDir string
|
taskDir string
|
||||||
allocDir *allocdir.AllocDir
|
allocDir *allocdir.AllocDir
|
||||||
killTimeout time.Duration
|
killTimeout time.Duration
|
||||||
|
version string
|
||||||
logger *log.Logger
|
logger *log.Logger
|
||||||
waitCh chan *cstructs.WaitResult
|
waitCh chan *cstructs.WaitResult
|
||||||
doneCh chan struct{}
|
doneCh chan struct{}
|
||||||
|
@ -189,6 +190,7 @@ func (d *JavaDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle,
|
||||||
taskDir: taskDir,
|
taskDir: taskDir,
|
||||||
allocDir: ctx.AllocDir,
|
allocDir: ctx.AllocDir,
|
||||||
killTimeout: d.DriverContext.KillTimeout(task),
|
killTimeout: d.DriverContext.KillTimeout(task),
|
||||||
|
version: d.config.Version,
|
||||||
logger: d.logger,
|
logger: d.logger,
|
||||||
doneCh: make(chan struct{}),
|
doneCh: make(chan struct{}),
|
||||||
waitCh: make(chan *cstructs.WaitResult, 1),
|
waitCh: make(chan *cstructs.WaitResult, 1),
|
||||||
|
@ -206,6 +208,7 @@ func (d *JavaDriver) cgroupsMounted(node *structs.Node) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
type javaId struct {
|
type javaId struct {
|
||||||
|
Version string
|
||||||
KillTimeout time.Duration
|
KillTimeout time.Duration
|
||||||
PluginConfig *PluginReattachConfig
|
PluginConfig *PluginReattachConfig
|
||||||
IsolationConfig *cstructs.IsolationConfig
|
IsolationConfig *cstructs.IsolationConfig
|
||||||
|
@ -252,6 +255,7 @@ func (d *JavaDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, erro
|
||||||
taskDir: id.TaskDir,
|
taskDir: id.TaskDir,
|
||||||
allocDir: id.AllocDir,
|
allocDir: id.AllocDir,
|
||||||
logger: d.logger,
|
logger: d.logger,
|
||||||
|
version: id.Version,
|
||||||
killTimeout: id.KillTimeout,
|
killTimeout: id.KillTimeout,
|
||||||
doneCh: make(chan struct{}),
|
doneCh: make(chan struct{}),
|
||||||
waitCh: make(chan *cstructs.WaitResult, 1),
|
waitCh: make(chan *cstructs.WaitResult, 1),
|
||||||
|
@ -263,6 +267,7 @@ func (d *JavaDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, erro
|
||||||
|
|
||||||
func (h *javaHandle) ID() string {
|
func (h *javaHandle) ID() string {
|
||||||
id := javaId{
|
id := javaId{
|
||||||
|
Version: h.version,
|
||||||
KillTimeout: h.killTimeout,
|
KillTimeout: h.killTimeout,
|
||||||
PluginConfig: NewPluginReattachConfig(h.pluginClient.ReattachConfig()),
|
PluginConfig: NewPluginReattachConfig(h.pluginClient.ReattachConfig()),
|
||||||
UserPid: h.userPid,
|
UserPid: h.userPid,
|
||||||
|
|
|
@ -50,6 +50,7 @@ type qemuHandle struct {
|
||||||
allocDir *allocdir.AllocDir
|
allocDir *allocdir.AllocDir
|
||||||
killTimeout time.Duration
|
killTimeout time.Duration
|
||||||
logger *log.Logger
|
logger *log.Logger
|
||||||
|
version string
|
||||||
waitCh chan *cstructs.WaitResult
|
waitCh chan *cstructs.WaitResult
|
||||||
doneCh chan struct{}
|
doneCh chan struct{}
|
||||||
}
|
}
|
||||||
|
@ -224,6 +225,7 @@ func (d *QemuDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle,
|
||||||
userPid: ps.Pid,
|
userPid: ps.Pid,
|
||||||
allocDir: ctx.AllocDir,
|
allocDir: ctx.AllocDir,
|
||||||
killTimeout: d.DriverContext.KillTimeout(task),
|
killTimeout: d.DriverContext.KillTimeout(task),
|
||||||
|
version: d.config.Version,
|
||||||
logger: d.logger,
|
logger: d.logger,
|
||||||
doneCh: make(chan struct{}),
|
doneCh: make(chan struct{}),
|
||||||
waitCh: make(chan *cstructs.WaitResult, 1),
|
waitCh: make(chan *cstructs.WaitResult, 1),
|
||||||
|
@ -234,6 +236,7 @@ func (d *QemuDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
type qemuId struct {
|
type qemuId struct {
|
||||||
|
Version string
|
||||||
KillTimeout time.Duration
|
KillTimeout time.Duration
|
||||||
UserPid int
|
UserPid int
|
||||||
PluginConfig *PluginReattachConfig
|
PluginConfig *PluginReattachConfig
|
||||||
|
@ -267,6 +270,7 @@ func (d *QemuDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, erro
|
||||||
allocDir: id.AllocDir,
|
allocDir: id.AllocDir,
|
||||||
logger: d.logger,
|
logger: d.logger,
|
||||||
killTimeout: id.KillTimeout,
|
killTimeout: id.KillTimeout,
|
||||||
|
version: id.Version,
|
||||||
doneCh: make(chan struct{}),
|
doneCh: make(chan struct{}),
|
||||||
waitCh: make(chan *cstructs.WaitResult, 1),
|
waitCh: make(chan *cstructs.WaitResult, 1),
|
||||||
}
|
}
|
||||||
|
@ -276,6 +280,7 @@ func (d *QemuDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, erro
|
||||||
|
|
||||||
func (h *qemuHandle) ID() string {
|
func (h *qemuHandle) ID() string {
|
||||||
id := qemuId{
|
id := qemuId{
|
||||||
|
Version: h.version,
|
||||||
KillTimeout: h.killTimeout,
|
KillTimeout: h.killTimeout,
|
||||||
PluginConfig: NewPluginReattachConfig(h.pluginClient.ReattachConfig()),
|
PluginConfig: NewPluginReattachConfig(h.pluginClient.ReattachConfig()),
|
||||||
UserPid: h.userPid,
|
UserPid: h.userPid,
|
||||||
|
|
|
@ -35,6 +35,7 @@ type RawExecDriver struct {
|
||||||
|
|
||||||
// rawExecHandle is returned from Start/Open as a handle to the PID
|
// rawExecHandle is returned from Start/Open as a handle to the PID
|
||||||
type rawExecHandle struct {
|
type rawExecHandle struct {
|
||||||
|
version string
|
||||||
pluginClient *plugin.Client
|
pluginClient *plugin.Client
|
||||||
userPid int
|
userPid int
|
||||||
executor executor.Executor
|
executor executor.Executor
|
||||||
|
@ -130,6 +131,7 @@ func (d *RawExecDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandl
|
||||||
userPid: ps.Pid,
|
userPid: ps.Pid,
|
||||||
killTimeout: d.DriverContext.KillTimeout(task),
|
killTimeout: d.DriverContext.KillTimeout(task),
|
||||||
allocDir: ctx.AllocDir,
|
allocDir: ctx.AllocDir,
|
||||||
|
version: d.config.Version,
|
||||||
logger: d.logger,
|
logger: d.logger,
|
||||||
doneCh: make(chan struct{}),
|
doneCh: make(chan struct{}),
|
||||||
waitCh: make(chan *cstructs.WaitResult, 1),
|
waitCh: make(chan *cstructs.WaitResult, 1),
|
||||||
|
@ -139,6 +141,7 @@ func (d *RawExecDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandl
|
||||||
}
|
}
|
||||||
|
|
||||||
type rawExecId struct {
|
type rawExecId struct {
|
||||||
|
Version string
|
||||||
KillTimeout time.Duration
|
KillTimeout time.Duration
|
||||||
UserPid int
|
UserPid int
|
||||||
PluginConfig *PluginReattachConfig
|
PluginConfig *PluginReattachConfig
|
||||||
|
@ -171,6 +174,7 @@ func (d *RawExecDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, e
|
||||||
logger: d.logger,
|
logger: d.logger,
|
||||||
killTimeout: id.KillTimeout,
|
killTimeout: id.KillTimeout,
|
||||||
allocDir: id.AllocDir,
|
allocDir: id.AllocDir,
|
||||||
|
version: id.Version,
|
||||||
doneCh: make(chan struct{}),
|
doneCh: make(chan struct{}),
|
||||||
waitCh: make(chan *cstructs.WaitResult, 1),
|
waitCh: make(chan *cstructs.WaitResult, 1),
|
||||||
}
|
}
|
||||||
|
@ -180,6 +184,7 @@ func (d *RawExecDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, e
|
||||||
|
|
||||||
func (h *rawExecHandle) ID() string {
|
func (h *rawExecHandle) ID() string {
|
||||||
id := rawExecId{
|
id := rawExecId{
|
||||||
|
Version: h.version,
|
||||||
KillTimeout: h.killTimeout,
|
KillTimeout: h.killTimeout,
|
||||||
PluginConfig: NewPluginReattachConfig(h.pluginClient.ReattachConfig()),
|
PluginConfig: NewPluginReattachConfig(h.pluginClient.ReattachConfig()),
|
||||||
UserPid: h.userPid,
|
UserPid: h.userPid,
|
||||||
|
|
|
@ -56,6 +56,7 @@ type TaskRunner struct {
|
||||||
|
|
||||||
// taskRunnerState is used to snapshot the state of the task runner
|
// taskRunnerState is used to snapshot the state of the task runner
|
||||||
type taskRunnerState struct {
|
type taskRunnerState struct {
|
||||||
|
Version string
|
||||||
Task *structs.Task
|
Task *structs.Task
|
||||||
HandleID string
|
HandleID string
|
||||||
}
|
}
|
||||||
|
@ -154,6 +155,7 @@ func (r *TaskRunner) RestoreState() error {
|
||||||
func (r *TaskRunner) SaveState() error {
|
func (r *TaskRunner) SaveState() error {
|
||||||
snap := taskRunnerState{
|
snap := taskRunnerState{
|
||||||
Task: r.task,
|
Task: r.task,
|
||||||
|
Version: r.config.Version,
|
||||||
}
|
}
|
||||||
r.handleLock.Lock()
|
r.handleLock.Lock()
|
||||||
if r.handle != nil {
|
if r.handle != nil {
|
||||||
|
|
|
@ -214,6 +214,7 @@ func (a *Agent) clientConfig() (*clientconfig.Config, error) {
|
||||||
httpAddr = fmt.Sprintf("%s:%d", addr.IP.String(), addr.Port)
|
httpAddr = fmt.Sprintf("%s:%d", addr.IP.String(), addr.Port)
|
||||||
}
|
}
|
||||||
conf.Node.HTTPAddr = httpAddr
|
conf.Node.HTTPAddr = httpAddr
|
||||||
|
conf.Version = a.config.Version
|
||||||
return conf, nil
|
return conf, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,4 +10,4 @@ const Version = "0.3.0"
|
||||||
// A pre-release marker for the version. If this is "" (empty string)
|
// A pre-release marker for the version. If this is "" (empty string)
|
||||||
// then it means that it is a final release. Otherwise, this is a pre-release
|
// then it means that it is a final release. Otherwise, this is a pre-release
|
||||||
// such as "dev" (in development), "beta", "rc1", etc.
|
// such as "dev" (in development), "beta", "rc1", etc.
|
||||||
const VersionPrerelease = "rc2"
|
const VersionPrerelease = ""
|
||||||
|
|
Loading…
Reference in a new issue