Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an interface to return scheduler framework instance #86218

Merged
merged 1 commit into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions pkg/scheduler/core/generic_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions pkg/scheduler/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down