mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
expose PredicateMetadataProducer in generic scheduler
This commit is contained in:
parent
3e5f6bdaa4
commit
f8ae5cdaf8
@ -131,6 +131,10 @@ type ScheduleAlgorithm interface {
|
|||||||
// Extenders returns a slice of extender config. This is exposed for
|
// Extenders returns a slice of extender config. This is exposed for
|
||||||
// testing.
|
// testing.
|
||||||
Extenders() []algorithm.SchedulerExtender
|
Extenders() []algorithm.SchedulerExtender
|
||||||
|
// GetPredicateMetadataProducer returns the predicate metadata producer. This is needed
|
||||||
|
// for cluster autoscaler integration.
|
||||||
|
// TODO(ahg-g): remove this once CA migrates to creating a Framework instead of a full scheduler.
|
||||||
|
PredicateMetadataProducer() predicates.PredicateMetadataProducer
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScheduleResult represents the result of one pod scheduled. It will contain
|
// ScheduleResult represents the result of one pod scheduled. It will contain
|
||||||
@ -171,6 +175,13 @@ func (g *genericScheduler) snapshot() error {
|
|||||||
return g.cache.UpdateNodeInfoSnapshot(g.nodeInfoSnapshot)
|
return g.cache.UpdateNodeInfoSnapshot(g.nodeInfoSnapshot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetPredicateMetadataProducer returns the predicate metadata producer. This is needed
|
||||||
|
// for cluster autoscaler integration.
|
||||||
|
func (g *genericScheduler) PredicateMetadataProducer() predicates.PredicateMetadataProducer {
|
||||||
|
return g.predicateMetaProducer
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Schedule tries to schedule the given pod to one of the nodes in the node list.
|
// Schedule tries to schedule the given pod to one of the nodes in the node list.
|
||||||
// If it succeeds, it will return the name of the node.
|
// If it succeeds, it will return the name of the node.
|
||||||
// If it fails, it will return a FitError error with reasons.
|
// If it fails, it will return a FitError error with reasons.
|
||||||
|
@ -152,6 +152,11 @@ type mockScheduler struct {
|
|||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (es mockScheduler) PredicateMetadataProducer() predicates.PredicateMetadataProducer {
|
||||||
|
return nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (es mockScheduler) Schedule(ctx context.Context, state *framework.CycleState, pod *v1.Pod) (core.ScheduleResult, error) {
|
func (es mockScheduler) Schedule(ctx context.Context, state *framework.CycleState, pod *v1.Pod) (core.ScheduleResult, error) {
|
||||||
return es.result, es.err
|
return es.result, es.err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user