diff --git a/.changelog/3883.txt b/.changelog/3883.txt new file mode 100644 index 00000000000..4f6d341f7d1 --- /dev/null +++ b/.changelog/3883.txt @@ -0,0 +1,8 @@ +```release-note:bug +plugin/nomad: Update Nomad task launcher plugin to respect namespace and region +configs in runner profile +``` +```release-note:bug +plugin/nomad-jobspec: Update Nomad jobspec status check to not report partial +health for deployments with canaries +``` \ No newline at end of file diff --git a/builtin/nomad/jobspec/platform.go b/builtin/nomad/jobspec/platform.go index d3454b997f0..6c9077ecdc2 100644 --- a/builtin/nomad/jobspec/platform.go +++ b/builtin/nomad/jobspec/platform.go @@ -257,6 +257,15 @@ func (p *Platform) resourceJobStatus( } } + // Need to subtract # of canaries in the update stanza from + // "completed". Canary allocs will end up in the "completed" + // state after the deployment, and thusly throw off the count + // of otherwise "completed" allocs, resulting in a partial + // state, when it's actually healthy + if complete > 0 { + complete = complete - *job.Update.Canary + } + if running == currentJobVersionAllocs && hasSquashedEvals == false { jobResource.Health = sdk.StatusReport_READY jobResource.HealthMessage = fmt.Sprintf("Job %q is reporting ready!", state.Name) diff --git a/builtin/nomad/task.go b/builtin/nomad/task.go index 4fa10ba2f65..4151862c039 100644 --- a/builtin/nomad/task.go +++ b/builtin/nomad/task.go @@ -271,7 +271,11 @@ func (p *TaskLauncher) StartTask( job.TaskGroups[0].Tasks[0].Config = config log.Debug("registering on-demand task job", "task-name", taskName) - _, _, err = jobclient.Register(job, nil) + writeOptions := &api.WriteOptions{ + Region: p.config.Region, + Namespace: p.config.Namespace, + } + _, _, err = jobclient.Register(job, writeOptions) if err != nil { log.Debug("failed to register job to nomad") return nil, err