mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
schedule: avoid in-place update of task if network resources are different
This commit is contained in:
@@ -227,6 +227,11 @@ func tasksUpdated(a, b *structs.TaskGroup) bool {
|
||||
if !reflect.DeepEqual(at.Config, bt.Config) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Inspect the network to see if the resource ask is different
|
||||
if !reflect.DeepEqual(at.Resources.Networks, bt.Resources.Networks) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -259,4 +259,10 @@ func TestTasksUpdated(t *testing.T) {
|
||||
if !tasksUpdated(j1.TaskGroups[0], j5.TaskGroups[0]) {
|
||||
t.Fatalf("bad")
|
||||
}
|
||||
|
||||
j6 := mock.Job()
|
||||
j6.TaskGroups[0].Tasks[0].Resources.Networks[0].DynamicPorts = 3
|
||||
if !tasksUpdated(j1.TaskGroups[0], j6.TaskGroups[0]) {
|
||||
t.Fatalf("bad")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user