Break nodelabel Filter plugins dependency on predicates package

This commit is contained in:
Haosdent Huang
2020-01-06 01:00:52 +08:00
parent 8b8f2aa4a5
commit 4ef31f81c7
5 changed files with 9 additions and 9 deletions

View File

@@ -6,8 +6,6 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodelabel",
visibility = ["//visibility:public"],
deps = [
"//pkg/scheduler/algorithm/predicates:go_default_library",
"//pkg/scheduler/framework/plugins/migration:go_default_library",
"//pkg/scheduler/framework/v1alpha1:go_default_library",
"//pkg/scheduler/nodeinfo:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",

View File

@@ -23,8 +23,6 @@ import (
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/migration"
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
"k8s.io/kubernetes/pkg/scheduler/nodeinfo"
)
@@ -32,6 +30,11 @@ import (
// Name of this plugin.
const Name = "NodeLabel"
const (
// ErrReasonPresenceViolated is used for CheckNodeLabelPresence predicate error.
ErrReasonPresenceViolated = "node(s) didn't have the requested labels"
)
// Args holds the args that are used to configure the plugin.
type Args struct {
// PresentLabels should be present for the node to be considered a fit for hosting the pod
@@ -118,7 +121,7 @@ func (pl *NodeLabel) Filter(ctx context.Context, _ *framework.CycleState, pod *v
return nil
}
return migration.PredicateResultToFrameworkStatus([]predicates.PredicateFailureReason{predicates.ErrNodeLabelPresenceViolated}, nil)
return framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonPresenceViolated)
}
// Score invoked at the score extension point.