Skip to content

Commit

Permalink
Merge pull request #549 from threefoldtech/development_zos4_fallback_…
Browse files Browse the repository at this point in the history
…to_zos3

fallback to zos3 nodes when no zos4 nodes found
  • Loading branch information
rawdaGastan authored Nov 6, 2024
2 parents 505775f + 088464f commit 01dfdb2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions provider/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ package provider

import (
"context"
"errors"
"slices"

"github.com/pulumi/pulumi-go-provider/infer"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/deployer"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
)

// Scheduler controlling struct
Expand Down Expand Up @@ -63,6 +66,11 @@ func (*Scheduler) Create(
nodeFilter, ssds, hdds := parseSchedulerInput(input)

nodes, err := deployer.FilterNodes(ctx, config.TFPluginClient, nodeFilter, hdds, ssds, nil)
if errors.Is(err, deployer.ErrNoNodesMatchesResources) && slices.Contains(nodeFilter.Features, zos.NetworkLightType) {
nodeFilter.Features = []string{zos.NetworkType, zos.ZMachineType}
nodes, err = deployer.FilterNodes(ctx, config.TFPluginClient, nodeFilter, hdds, ssds, nil)
}

if err != nil {
return id, state, err
}
Expand Down

0 comments on commit 01dfdb2

Please sign in to comment.