MRD: deregister regions that are dropped on update (#8763)

This changeset is the OSS hooks for what will be implemented in ENT.
This commit is contained in:
Tim Gross 2020-08-27 14:54:45 -04:00 committed by GitHub
parent 4eba6be8b1
commit 606df14e78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -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
}
@ -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

View file

@ -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