diff --git a/scheduler/util.go b/scheduler/util.go index 14981493a..b0a3ed7c7 100644 --- a/scheduler/util.go +++ b/scheduler/util.go @@ -437,6 +437,10 @@ func networkUpdated(netA, netB []*structs.NetworkResource) bool { an := netA[idx] bn := netB[idx] + if an.Mode != bn.Mode { + return true + } + if an.MBits != bn.MBits { return true } diff --git a/scheduler/util_test.go b/scheduler/util_test.go index 55b67d9bd..56d2d2e6d 100644 --- a/scheduler/util_test.go +++ b/scheduler/util_test.go @@ -675,6 +675,20 @@ func TestTasksUpdated(t *testing.T) { j18 := mock.Job() j18.Meta["j18_test"] = "roll_baby_roll" require.True(t, tasksUpdated(j1, j18, name)) + + // Change network mode + j19 := mock.Job() + j19.TaskGroups[0].Networks = j19.TaskGroups[0].Tasks[0].Resources.Networks + j19.TaskGroups[0].Tasks[0].Resources.Networks = nil + + j20 := mock.Job() + j20.TaskGroups[0].Networks = j20.TaskGroups[0].Tasks[0].Resources.Networks + j20.TaskGroups[0].Tasks[0].Resources.Networks = nil + + require.False(t, tasksUpdated(j19, j20, name)) + + j20.TaskGroups[0].Networks[0].Mode = "bridge" + require.True(t, tasksUpdated(j19, j20, name)) } func TestEvictAndPlace_LimitLessThanAllocs(t *testing.T) {