Skip to content

Commit

Permalink
go/runtime/host/loadbalance: Pass-through for non-RONL components
Browse files Browse the repository at this point in the history
  • Loading branch information
kostko committed Apr 3, 2024
1 parent 87a99fe commit aca4689
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions go/runtime/host/loadbalance/loadbalance.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/oasisprotocol/oasis-core/go/common/node"
"github.com/oasisprotocol/oasis-core/go/common/pubsub"
"github.com/oasisprotocol/oasis-core/go/common/version"
"github.com/oasisprotocol/oasis-core/go/runtime/bundle"
"github.com/oasisprotocol/oasis-core/go/runtime/host"
"github.com/oasisprotocol/oasis-core/go/runtime/host/protocol"
)
Expand Down Expand Up @@ -265,6 +266,14 @@ func (lb *lbProvisioner) NewRuntime(cfg host.Config) (host.Runtime, error) {
return nil, fmt.Errorf("host/loadbalance: number of instances must be at least two")
}

// The load-balancer can only be used for the RONL component. For others, do pass-through.
if len(cfg.Components) != 1 {
return nil, fmt.Errorf("host/loadbalance: must specify a single component")

Check warning on line 271 in go/runtime/host/loadbalance/loadbalance.go

View check run for this annotation

Codecov / codecov/patch

go/runtime/host/loadbalance/loadbalance.go#L270-L271

Added lines #L270 - L271 were not covered by tests
}
if cfg.Components[0] != bundle.ComponentID_RONL {
return lb.inner.NewRuntime(cfg)

Check warning on line 274 in go/runtime/host/loadbalance/loadbalance.go

View check run for this annotation

Codecov / codecov/patch

go/runtime/host/loadbalance/loadbalance.go#L273-L274

Added lines #L273 - L274 were not covered by tests
}

// Use the inner provisioner to provision multiple runtimes.
var instances []host.Runtime
for i := 0; i < lb.cfg.NumInstances; i++ {
Expand Down

0 comments on commit aca4689

Please sign in to comment.