Skip to content

Commit

Permalink
MRD: deregister regions that are dropped on update (#8763)
Browse files Browse the repository at this point in the history
This changeset is the OSS hooks for what will be implemented in ENT.
  • Loading branch information
tgross committed Aug 27, 2020
1 parent 63db66b commit a79d679
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions nomad/job_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,12 @@ func (j *Job) Register(args *structs.JobRegisterRequest, reply *structs.JobRegis
args.Job.JobModifyIndex = reply.JobModifyIndex

if eval == nil {
// For dispatch jobs we return early, so we need to drop regions
// here rather than after eval for deployments is kicked off
err = j.multiregionDrop(args, reply)
if err != nil {
return err
}
return nil
}

Expand Down Expand Up @@ -424,6 +430,14 @@ func (j *Job) Register(args *structs.JobRegisterRequest, reply *structs.JobRegis
if err != nil {
return err
}
// We drop any unwanted regions only once we know all jobs have
// been registered and we've kicked off the deployment. This keeps
// dropping regions close in semantics to dropping task groups in
// single-region deployments
err = j.multiregionDrop(args, reply)
if err != nil {
return err
}
}

return nil
Expand Down
6 changes: 6 additions & 0 deletions nomad/job_endpoint_oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ func (j *Job) multiregionStart(args *structs.JobRegisterRequest, reply *structs.
return nil
}

// multiregionDrop is used to deregister regions from a previous version of the
// job that are no longer in use
func (j *Job) multiregionDrop(args *structs.JobRegisterRequest, reply *structs.JobRegisterResponse) error {
return nil
}

// interpolateMultiregionFields interpolates a job for a specific region
func (j *Job) interpolateMultiregionFields(args *structs.JobPlanRequest) error {
return nil
Expand Down

0 comments on commit a79d679

Please sign in to comment.