mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 23:15:14 +00:00
Merge pull request #86218 from ahg-g/ahg-framework
Add an interface to return scheduler framework instance
This commit is contained in:
commit
bb03061010
@ -141,6 +141,9 @@ type ScheduleAlgorithm interface {
|
||||
// for cluster autoscaler integration.
|
||||
// TODO(#85691): remove this once CA migrates to creating a Framework instead of a full scheduler.
|
||||
Snapshot() error
|
||||
// Framework returns the scheduler framework instance. This is needed for cluster autoscaler integration.
|
||||
// TODO(#85691): remove this once CA migrates to creating a Framework instead of a full scheduler.
|
||||
Framework() framework.Framework
|
||||
}
|
||||
|
||||
// ScheduleResult represents the result of one pod scheduled. It will contain
|
||||
@ -174,14 +177,20 @@ type genericScheduler struct {
|
||||
nextStartNodeIndex int
|
||||
}
|
||||
|
||||
// snapshot snapshots scheduler cache and node infos for all fit and priority
|
||||
// Snapshot snapshots scheduler cache and node infos for all fit and priority
|
||||
// functions.
|
||||
func (g *genericScheduler) Snapshot() error {
|
||||
// Used for all fit and priority funcs.
|
||||
return g.cache.UpdateNodeInfoSnapshot(g.nodeInfoSnapshot)
|
||||
}
|
||||
|
||||
// GetPredicateMetadataProducer returns the predicate metadata producer. This is needed
|
||||
// Framework returns the framework instance.
|
||||
func (g *genericScheduler) Framework() framework.Framework {
|
||||
// Used for all fit and priority funcs.
|
||||
return g.framework
|
||||
}
|
||||
|
||||
// PredicateMetadataProducer returns the predicate metadata producer. This is needed
|
||||
// for cluster autoscaler integration.
|
||||
func (g *genericScheduler) PredicateMetadataProducer() predicates.MetadataProducer {
|
||||
return g.predicateMetaProducer
|
||||
|
@ -179,6 +179,10 @@ func (es mockScheduler) Preempt(ctx context.Context, state *framework.CycleState
|
||||
func (es mockScheduler) Snapshot() error {
|
||||
return nil
|
||||
|
||||
}
|
||||
func (es mockScheduler) Framework() framework.Framework {
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func TestSchedulerCreation(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user