mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Merge pull request #82735 from ahmad-diaa/remove-NewConfigFactory-compatibility-test
Improve Scheduler Compatibility Test
This commit is contained in:
commit
40a8d9ebee
@ -5,18 +5,18 @@ go_test(
|
|||||||
srcs = ["compatibility_test.go"],
|
srcs = ["compatibility_test.go"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/apis/core/install:go_default_library",
|
"//pkg/apis/core/install:go_default_library",
|
||||||
|
"//pkg/scheduler:go_default_library",
|
||||||
"//pkg/scheduler/algorithmprovider/defaults:go_default_library",
|
"//pkg/scheduler/algorithmprovider/defaults:go_default_library",
|
||||||
"//pkg/scheduler/api:go_default_library",
|
"//pkg/scheduler/api:go_default_library",
|
||||||
"//pkg/scheduler/api/latest:go_default_library",
|
"//pkg/scheduler/apis/config:go_default_library",
|
||||||
|
"//pkg/scheduler/core:go_default_library",
|
||||||
"//pkg/scheduler/factory:go_default_library",
|
"//pkg/scheduler/factory:go_default_library",
|
||||||
|
"//pkg/scheduler/framework/plugins:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/informers:go_default_library",
|
"//staging/src/k8s.io/client-go/informers:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes/fake:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/rest:go_default_library",
|
|
||||||
"//staging/src/k8s.io/client-go/util/testing:go_default_library",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -114,6 +114,36 @@ func NewHTTPExtender(config *schedulerapi.ExtenderConfig) (algorithm.SchedulerEx
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Equal is used to check if two extenders are equal
|
||||||
|
// ignoring the client field, exported for testing
|
||||||
|
func Equal(e1, e2 *HTTPExtender) bool {
|
||||||
|
if e1.extenderURL != e2.extenderURL {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if e1.preemptVerb != e2.preemptVerb {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if e1.prioritizeVerb != e2.prioritizeVerb {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if e1.bindVerb != e2.bindVerb {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if e1.weight != e2.weight {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if e1.nodeCacheCapable != e2.nodeCacheCapable {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if !e1.managedResources.Equal(e2.managedResources) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if e1.ignorable != e2.ignorable {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// Name returns extenderURL to identify the extender.
|
// Name returns extenderURL to identify the extender.
|
||||||
func (h *HTTPExtender) Name() string {
|
func (h *HTTPExtender) Name() string {
|
||||||
return h.extenderURL
|
return h.extenderURL
|
||||||
|
@ -144,6 +144,9 @@ type ScheduleAlgorithm interface {
|
|||||||
// Prioritizers returns a slice of priority config. This is exposed for
|
// Prioritizers returns a slice of priority config. This is exposed for
|
||||||
// testing.
|
// testing.
|
||||||
Prioritizers() []priorities.PriorityConfig
|
Prioritizers() []priorities.PriorityConfig
|
||||||
|
// Extenders returns a slice of extender config. This is exposed for
|
||||||
|
// testing.
|
||||||
|
Extenders() []algorithm.SchedulerExtender
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScheduleResult represents the result of one pod scheduled. It will contain
|
// ScheduleResult represents the result of one pod scheduled. It will contain
|
||||||
@ -280,6 +283,10 @@ func (g *genericScheduler) Predicates() map[string]predicates.FitPredicate {
|
|||||||
return g.predicates
|
return g.predicates
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *genericScheduler) Extenders() []algorithm.SchedulerExtender {
|
||||||
|
return g.extenders
|
||||||
|
}
|
||||||
|
|
||||||
// selectHost takes a prioritized list of nodes and then picks one
|
// selectHost takes a prioritized list of nodes and then picks one
|
||||||
// in a reservoir sampling manner from the nodes that had the highest score.
|
// in a reservoir sampling manner from the nodes that had the highest score.
|
||||||
func (g *genericScheduler) selectHost(priorityList schedulerapi.HostPriorityList) (string, error) {
|
func (g *genericScheduler) selectHost(priorityList schedulerapi.HostPriorityList) (string, error) {
|
||||||
|
@ -163,6 +163,9 @@ func (es mockScheduler) Predicates() map[string]predicates.FitPredicate {
|
|||||||
func (es mockScheduler) Prioritizers() []priorities.PriorityConfig {
|
func (es mockScheduler) Prioritizers() []priorities.PriorityConfig {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (es mockScheduler) Extenders() []algorithm.SchedulerExtender {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (es mockScheduler) Preempt(pc *framework.PluginContext, pod *v1.Pod, scheduleErr error) (*v1.Node, []*v1.Pod, []*v1.Pod, error) {
|
func (es mockScheduler) Preempt(pc *framework.PluginContext, pod *v1.Pod, scheduleErr error) (*v1.Node, []*v1.Pod, []*v1.Pod, error) {
|
||||||
return nil, nil, nil, nil
|
return nil, nil, nil, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user