From e129d580bd096ad329ef1b22bd7736ab93bf24c7 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Sat, 12 Sep 2020 15:56:40 +0800 Subject: [PATCH] scheduler: ignore network type when specified --- .../algorithm/predicates/network_predicate.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/scheduler/algorithm/predicates/network_predicate.go b/pkg/scheduler/algorithm/predicates/network_predicate.go index 887348cc5c..f825a3f0c6 100644 --- a/pkg/scheduler/algorithm/predicates/network_predicate.go +++ b/pkg/scheduler/algorithm/predicates/network_predicate.go @@ -118,13 +118,6 @@ func IsNetworkAvailable( return len(data.HostId) > 0 } - if !isMatchServerType(n.SNetwork) { - return FailReason{ - Reason: fmt.Sprintf("Network %s type %s match", n.Name, n.ServerType), - Type: NetworkTypeMatch, - } - } - if n.IsExitNetwork() != exit { return FailReason{Reason: ErrExitIsNotMatch} } @@ -176,6 +169,14 @@ func IsNetworkAvailable( Type: NetworkMatch, } } + } else { + if !isMatchServerType(n.SNetwork) { + return FailReason{ + Reason: fmt.Sprintf("Network %s type %s match", n.Name, n.ServerType), + Type: NetworkTypeMatch, + } + } + } if req.Network == "" && n.IsAutoAlloc.IsFalse() {