mirror of
https://github.com/kemko/nomad.git
synced 2026-01-08 19:35:41 +03:00
fix failing tests
This commit is contained in:
@@ -123,6 +123,12 @@ func netModeToIsolationMode(netMode string) drivers.NetIsolationMode {
|
||||
|
||||
func newNetworkConfigurator(alloc *structs.Allocation, config *clientconfig.Config) NetworkConfigurator {
|
||||
tg := alloc.Job.LookupTaskGroup(alloc.TaskGroup)
|
||||
|
||||
// Check if network stanza is given
|
||||
if len(tg.Networks) == 0 {
|
||||
return &hostNetworkConfigurator{}
|
||||
}
|
||||
|
||||
switch strings.ToLower(tg.Networks[0].Mode) {
|
||||
case "bridge":
|
||||
return newBridgeNetworkConfigurator(context.Background(), config.BridgeNetworkName, config.BridgeNetworkAllocSubnet, config.CNIPath)
|
||||
|
||||
@@ -484,8 +484,10 @@ func (s *GenericScheduler) computePlacements(destructive, place []placementResul
|
||||
// Set fields based on if we found an allocation option
|
||||
if option != nil {
|
||||
resources := &structs.AllocatedResources{
|
||||
Tasks: option.TaskResources,
|
||||
Shared: *option.GroupResources,
|
||||
Tasks: option.TaskResources,
|
||||
}
|
||||
if option.AllocResources != nil {
|
||||
resources.Shared = *option.AllocResources
|
||||
}
|
||||
|
||||
// Create an allocation for this
|
||||
|
||||
@@ -21,7 +21,7 @@ type RankedNode struct {
|
||||
FinalScore float64
|
||||
Scores []float64
|
||||
TaskResources map[string]*structs.AllocatedTaskResources
|
||||
GroupResources *structs.AllocatedSharedResources
|
||||
AllocResources *structs.AllocatedSharedResources
|
||||
|
||||
// Allocs is used to cache the proposed allocations on the
|
||||
// node. This can be shared between iterators that require it.
|
||||
@@ -271,7 +271,7 @@ OUTER:
|
||||
|
||||
// Update the network ask to the offer
|
||||
total.Shared.Networks = []*structs.NetworkResource{offer}
|
||||
option.GroupResources = &structs.AllocatedSharedResources{
|
||||
option.AllocResources = &structs.AllocatedSharedResources{
|
||||
Networks: []*structs.NetworkResource{offer},
|
||||
DiskMB: int64(iter.taskGroup.EphemeralDisk.SizeMB),
|
||||
}
|
||||
|
||||
@@ -835,9 +835,12 @@ func genericAllocUpdateFn(ctx Context, stack Stack, evalID string) allocUpdateTy
|
||||
newAlloc.Job = nil // Use the Job in the Plan
|
||||
newAlloc.Resources = nil // Computed in Plan Apply
|
||||
newAlloc.AllocatedResources = &structs.AllocatedResources{
|
||||
Tasks: option.TaskResources,
|
||||
Shared: *option.GroupResources,
|
||||
Tasks: option.TaskResources,
|
||||
}
|
||||
if option.AllocResources != nil {
|
||||
newAlloc.AllocatedResources.Shared = *option.AllocResources
|
||||
}
|
||||
|
||||
// Use metrics from existing alloc for in place upgrade
|
||||
// This is because if the inplace upgrade succeeded, any scoring metadata from
|
||||
// when it first went through the scheduler should still be preserved. Using scoring
|
||||
|
||||
Reference in New Issue
Block a user