mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
job_endpoint: check spec for all regions (#14519)
* job_endpoint: check spec for all regions
This commit is contained in:
3
.changelog/14519.txt
Normal file
3
.changelog/14519.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:bug
|
||||
rpc: check for spec changes in all regions when registering multiregion jobs
|
||||
```
|
||||
@@ -349,7 +349,12 @@ func (j *Job) Register(args *structs.JobRegisterRequest, reply *structs.JobRegis
|
||||
}
|
||||
|
||||
// Check if the job has changed at all
|
||||
if existingJob == nil || existingJob.SpecChanged(args.Job) {
|
||||
specChanged, err := j.multiregionSpecChanged(existingJob, args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if existingJob == nil || specChanged {
|
||||
|
||||
// COMPAT(1.1.0): Remove the ServerMeetMinimumVersion check to always set args.Eval
|
||||
// 0.12.1 introduced atomic eval job registration
|
||||
|
||||
@@ -38,3 +38,12 @@ func (j *Job) multiregionStop(job *structs.Job, args *structs.JobDeregisterReque
|
||||
func (j *Job) interpolateMultiregionFields(args *structs.JobPlanRequest) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// multiregionSpecChanged checks to see if the job spec has changed. If the job is multiregion,
|
||||
// it checks all regions to determine if any deployed jobs instances have been stopped or
|
||||
// otherwise differ from the incoming jobspec. Since multiregion jobs require coordinated
|
||||
// deployments and synchronized job versions across all regions, a change in one requires
|
||||
// redeployment of all.
|
||||
func (j *Job) multiregionSpecChanged(existingJob *structs.Job, args *structs.JobRegisterRequest) (bool, error) {
|
||||
return existingJob.SpecChanged(args.Job), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user