diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index 682135d9c3c..f83f7cf7e57 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -2184,6 +2184,13 @@ func (j *Job) Validate() error { } } + for idx, spread := range j.Spreads { + if err := spread.Validate(); err != nil { + outer := fmt.Errorf("Spread %d validation failed: %s", idx+1, err) + mErr.Errors = append(mErr.Errors, outer) + } + } + // Check for duplicate task groups taskGroups := make(map[string]int) for idx, tg := range j.TaskGroups { @@ -3449,6 +3456,13 @@ func (tg *TaskGroup) Validate(j *Job) error { mErr.Errors = append(mErr.Errors, fmt.Errorf("Task Group %v should have a restart policy", tg.Name)) } + for idx, spread := range tg.Spreads { + if err := spread.Validate(); err != nil { + outer := fmt.Errorf("Spread %d validation failed: %s", idx+1, err) + mErr.Errors = append(mErr.Errors, outer) + } + } + if j.Type == JobTypeSystem { if tg.ReschedulePolicy != nil { mErr.Errors = append(mErr.Errors, fmt.Errorf("System jobs should not have a reschedule policy"))