mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Break volumebinding Filter plugins dependency on predicates package
This commit is contained in:
parent
180e1c9f51
commit
d27dc6751e
@ -71,10 +71,6 @@ var (
|
|||||||
ErrNodeUnschedulable = NewPredicateFailureError("NodeUnschedulable", "node(s) were unschedulable")
|
ErrNodeUnschedulable = NewPredicateFailureError("NodeUnschedulable", "node(s) were unschedulable")
|
||||||
// ErrNodeUnknownCondition is used for NodeUnknownCondition predicate error.
|
// ErrNodeUnknownCondition is used for NodeUnknownCondition predicate error.
|
||||||
ErrNodeUnknownCondition = NewPredicateFailureError("NodeUnknownCondition", "node(s) had unknown conditions")
|
ErrNodeUnknownCondition = NewPredicateFailureError("NodeUnknownCondition", "node(s) had unknown conditions")
|
||||||
// ErrVolumeNodeConflict is used for VolumeNodeAffinityConflict predicate error.
|
|
||||||
ErrVolumeNodeConflict = NewPredicateFailureError("VolumeNodeAffinityConflict", "node(s) had volume node affinity conflict")
|
|
||||||
// ErrVolumeBindConflict is used for VolumeBindingNoMatch predicate error.
|
|
||||||
ErrVolumeBindConflict = NewPredicateFailureError("VolumeBindingNoMatch", "node(s) didn't find available persistent volumes to bind")
|
|
||||||
// ErrTopologySpreadConstraintsNotMatch is used for EvenPodsSpread predicate error.
|
// ErrTopologySpreadConstraintsNotMatch is used for EvenPodsSpread predicate error.
|
||||||
ErrTopologySpreadConstraintsNotMatch = NewPredicateFailureError("EvenPodsSpreadNotMatch", "node(s) didn't match pod topology spread constraints")
|
ErrTopologySpreadConstraintsNotMatch = NewPredicateFailureError("EvenPodsSpreadNotMatch", "node(s) didn't match pod topology spread constraints")
|
||||||
// ErrFakePredicate is used for test only. The fake predicates returning false also returns error
|
// ErrFakePredicate is used for test only. The fake predicates returning false also returns error
|
||||||
@ -99,8 +95,6 @@ var unresolvablePredicateFailureErrors = map[PredicateFailureReason]struct{}{
|
|||||||
ErrNodeUnschedulable: {},
|
ErrNodeUnschedulable: {},
|
||||||
ErrNodeUnknownCondition: {},
|
ErrNodeUnknownCondition: {},
|
||||||
ErrVolumeZoneConflict: {},
|
ErrVolumeZoneConflict: {},
|
||||||
ErrVolumeNodeConflict: {},
|
|
||||||
ErrVolumeBindConflict: {},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnresolvablePredicateExists checks if there is at least one unresolvable predicate failure reason.
|
// UnresolvablePredicateExists checks if there is at least one unresolvable predicate failure reason.
|
||||||
|
@ -58,6 +58,7 @@ go_test(
|
|||||||
"//pkg/scheduler/framework/plugins/interpodaffinity:go_default_library",
|
"//pkg/scheduler/framework/plugins/interpodaffinity:go_default_library",
|
||||||
"//pkg/scheduler/framework/plugins/noderesources:go_default_library",
|
"//pkg/scheduler/framework/plugins/noderesources:go_default_library",
|
||||||
"//pkg/scheduler/framework/plugins/podtopologyspread:go_default_library",
|
"//pkg/scheduler/framework/plugins/podtopologyspread:go_default_library",
|
||||||
|
"//pkg/scheduler/framework/plugins/volumebinding:go_default_library",
|
||||||
"//pkg/scheduler/framework/v1alpha1:go_default_library",
|
"//pkg/scheduler/framework/v1alpha1:go_default_library",
|
||||||
"//pkg/scheduler/internal/cache:go_default_library",
|
"//pkg/scheduler/internal/cache:go_default_library",
|
||||||
"//pkg/scheduler/internal/queue:go_default_library",
|
"//pkg/scheduler/internal/queue:go_default_library",
|
||||||
|
@ -46,6 +46,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/noderesources"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/noderesources"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/podtopologyspread"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/podtopologyspread"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumebinding"
|
||||||
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
||||||
internalcache "k8s.io/kubernetes/pkg/scheduler/internal/cache"
|
internalcache "k8s.io/kubernetes/pkg/scheduler/internal/cache"
|
||||||
internalqueue "k8s.io/kubernetes/pkg/scheduler/internal/queue"
|
internalqueue "k8s.io/kubernetes/pkg/scheduler/internal/queue"
|
||||||
@ -1947,8 +1948,8 @@ func TestNodesWherePreemptionMightHelp(t *testing.T) {
|
|||||||
name: "ErrVolume... errors should not be tried as it indicates that the pod is unschedulable due to no matching volumes for pod on node",
|
name: "ErrVolume... errors should not be tried as it indicates that the pod is unschedulable due to no matching volumes for pod on node",
|
||||||
nodesStatuses: framework.NodeToStatusMap{
|
nodesStatuses: framework.NodeToStatusMap{
|
||||||
"machine1": framework.NewStatus(framework.UnschedulableAndUnresolvable, algorithmpredicates.ErrVolumeZoneConflict.GetReason()),
|
"machine1": framework.NewStatus(framework.UnschedulableAndUnresolvable, algorithmpredicates.ErrVolumeZoneConflict.GetReason()),
|
||||||
"machine2": framework.NewStatus(framework.UnschedulableAndUnresolvable, algorithmpredicates.ErrVolumeNodeConflict.GetReason()),
|
"machine2": framework.NewStatus(framework.UnschedulableAndUnresolvable, volumebinding.ErrReasonNodeConflict),
|
||||||
"machine3": framework.NewStatus(framework.UnschedulableAndUnresolvable, algorithmpredicates.ErrVolumeBindConflict.GetReason()),
|
"machine3": framework.NewStatus(framework.UnschedulableAndUnresolvable, volumebinding.ErrReasonBindConflict),
|
||||||
},
|
},
|
||||||
expected: map[string]bool{"machine4": true},
|
expected: map[string]bool{"machine4": true},
|
||||||
},
|
},
|
||||||
|
@ -6,7 +6,6 @@ go_library(
|
|||||||
importpath = "k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumebinding",
|
importpath = "k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumebinding",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/scheduler/algorithm/predicates:go_default_library",
|
|
||||||
"//pkg/scheduler/framework/v1alpha1:go_default_library",
|
"//pkg/scheduler/framework/v1alpha1:go_default_library",
|
||||||
"//pkg/scheduler/nodeinfo:go_default_library",
|
"//pkg/scheduler/nodeinfo:go_default_library",
|
||||||
"//pkg/scheduler/volumebinder:go_default_library",
|
"//pkg/scheduler/volumebinder:go_default_library",
|
||||||
@ -34,7 +33,6 @@ go_test(
|
|||||||
embed = [":go_default_library"],
|
embed = [":go_default_library"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/controller/volume/scheduling:go_default_library",
|
"//pkg/controller/volume/scheduling:go_default_library",
|
||||||
"//pkg/scheduler/algorithm/predicates:go_default_library",
|
|
||||||
"//pkg/scheduler/framework/v1alpha1:go_default_library",
|
"//pkg/scheduler/framework/v1alpha1:go_default_library",
|
||||||
"//pkg/scheduler/nodeinfo:go_default_library",
|
"//pkg/scheduler/nodeinfo:go_default_library",
|
||||||
"//pkg/scheduler/volumebinder:go_default_library",
|
"//pkg/scheduler/volumebinder:go_default_library",
|
||||||
|
@ -20,7 +20,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
|
|
||||||
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
||||||
schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"
|
schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/volumebinder"
|
"k8s.io/kubernetes/pkg/scheduler/volumebinder"
|
||||||
@ -36,6 +35,13 @@ var _ framework.FilterPlugin = &VolumeBinding{}
|
|||||||
// Name is the name of the plugin used in Registry and configurations.
|
// Name is the name of the plugin used in Registry and configurations.
|
||||||
const Name = "VolumeBinding"
|
const Name = "VolumeBinding"
|
||||||
|
|
||||||
|
const (
|
||||||
|
// ErrReasonBindConflict is used for VolumeBindingNoMatch predicate error.
|
||||||
|
ErrReasonBindConflict = "node(s) didn't find available persistent volumes to bind"
|
||||||
|
// ErrReasonNodeConflict is used for VolumeNodeAffinityConflict predicate error.
|
||||||
|
ErrReasonNodeConflict = "node(s) had volume node affinity conflict"
|
||||||
|
)
|
||||||
|
|
||||||
// Name returns name of the plugin. It is used in logs, etc.
|
// Name returns name of the plugin. It is used in logs, etc.
|
||||||
func (pl *VolumeBinding) Name() string {
|
func (pl *VolumeBinding) Name() string {
|
||||||
return Name
|
return Name
|
||||||
@ -81,10 +87,10 @@ func (pl *VolumeBinding) Filter(ctx context.Context, cs *framework.CycleState, p
|
|||||||
if !boundSatisfied || !unboundSatisfied {
|
if !boundSatisfied || !unboundSatisfied {
|
||||||
status := framework.NewStatus(framework.UnschedulableAndUnresolvable)
|
status := framework.NewStatus(framework.UnschedulableAndUnresolvable)
|
||||||
if !boundSatisfied {
|
if !boundSatisfied {
|
||||||
status.AppendReason(predicates.ErrVolumeNodeConflict.GetReason())
|
status.AppendReason(ErrReasonNodeConflict)
|
||||||
}
|
}
|
||||||
if !unboundSatisfied {
|
if !unboundSatisfied {
|
||||||
status.AppendReason(predicates.ErrVolumeBindConflict.GetReason())
|
status.AppendReason(ErrReasonBindConflict)
|
||||||
}
|
}
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ import (
|
|||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
volumescheduling "k8s.io/kubernetes/pkg/controller/volume/scheduling"
|
volumescheduling "k8s.io/kubernetes/pkg/controller/volume/scheduling"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
|
|
||||||
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
||||||
schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"
|
schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/volumebinder"
|
"k8s.io/kubernetes/pkg/scheduler/volumebinder"
|
||||||
@ -73,7 +72,7 @@ func TestVolumeBinding(t *testing.T) {
|
|||||||
FindUnboundSatsified: false,
|
FindUnboundSatsified: false,
|
||||||
FindBoundSatsified: true,
|
FindBoundSatsified: true,
|
||||||
},
|
},
|
||||||
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, predicates.ErrVolumeBindConflict.GetReason()),
|
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonBindConflict),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "bound and unbound unsatisfied",
|
name: "bound and unbound unsatisfied",
|
||||||
@ -83,8 +82,8 @@ func TestVolumeBinding(t *testing.T) {
|
|||||||
FindUnboundSatsified: false,
|
FindUnboundSatsified: false,
|
||||||
FindBoundSatsified: false,
|
FindBoundSatsified: false,
|
||||||
},
|
},
|
||||||
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, predicates.ErrVolumeNodeConflict.GetReason(),
|
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonNodeConflict,
|
||||||
predicates.ErrVolumeBindConflict.GetReason()),
|
ErrReasonBindConflict),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "unbound/found matches/bind succeeds",
|
name: "unbound/found matches/bind succeeds",
|
||||||
|
Loading…
Reference in New Issue
Block a user