diff --git a/scheduler/generic_sched.go b/scheduler/generic_sched.go index 8e2fa9e57..3f27783dc 100644 --- a/scheduler/generic_sched.go +++ b/scheduler/generic_sched.go @@ -509,9 +509,11 @@ func (s *GenericScheduler) computePlacements(destructive, place []placementResul AllocatedResources: resources, DesiredStatus: structs.AllocDesiredStatusRun, ClientStatus: structs.AllocClientStatusPending, + // SharedResources is considered deprecated, will be removed in 0.11. + // It is only set for compat reasons. SharedResources: &structs.Resources{ DiskMB: tg.EphemeralDisk.SizeMB, - Networks: tg.Networks, + Networks: resources.Shared.Networks, }, } diff --git a/scheduler/system_sched.go b/scheduler/system_sched.go index 993533116..ec661efbb 100644 --- a/scheduler/system_sched.go +++ b/scheduler/system_sched.go @@ -363,9 +363,11 @@ func (s *SystemScheduler) computePlacements(place []allocTuple) error { AllocatedResources: resources, DesiredStatus: structs.AllocDesiredStatusRun, ClientStatus: structs.AllocClientStatusPending, + // SharedResources is considered deprecated, will be removed in 0.11. + // It is only set for compat reasons SharedResources: &structs.Resources{ DiskMB: missing.TaskGroup.EphemeralDisk.SizeMB, - Networks: missing.TaskGroup.Networks, + Networks: resources.Shared.Networks, }, } diff --git a/scheduler/util.go b/scheduler/util.go index 118fb1b0b..0d226171e 100644 --- a/scheduler/util.go +++ b/scheduler/util.go @@ -822,7 +822,7 @@ func genericAllocUpdateFn(ctx Context, stack Stack, evalID string) allocUpdateTy networks = tr.Networks } - // Add thhe networks back + // Add the networks back resources.Networks = networks } @@ -837,8 +837,11 @@ func genericAllocUpdateFn(ctx Context, stack Stack, evalID string) allocUpdateTy newAlloc.AllocatedResources = &structs.AllocatedResources{ Tasks: option.TaskResources, Shared: structs.AllocatedSharedResources{ - DiskMB: int64(newTG.EphemeralDisk.SizeMB), - Networks: newTG.Networks, + DiskMB: int64(newTG.EphemeralDisk.SizeMB), + // Since this is an inplace update, we should copy network + // information from the original alloc. This is similar to + // how we copy network info for task level networks above. + Networks: existing.AllocatedResources.Shared.Networks, }, }