Added PredicateMetadata and PriorityMetadata as CycleState to the framework
This commit is contained in:
@@ -47,3 +47,44 @@ func ErrorToFrameworkStatus(err error) *framework.Status {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
const (
|
||||
// PredicatesStateKey is the key in CycleState to PredicateStateData
|
||||
PredicatesStateKey = "predicates"
|
||||
|
||||
// PrioritiesStateKey is the key in CycleState to PrioritiesStateData
|
||||
PrioritiesStateKey = "priorities"
|
||||
)
|
||||
|
||||
// PredicatesStateData is a pointer to PredicateMetadata. In the normal case, StateData is supposed to
|
||||
// be generated and stored in CycleState by a framework plugin (like a PreFilter pre-computing data for
|
||||
// its corresponding Filter). However, during migration, the scheduler will inject a pointer to
|
||||
// PredicateMetadata into CycleState. This "hack" is necessary because during migration Filters that implement
|
||||
// predicates functionality will be calling into the existing predicate functions, and need
|
||||
// to pass PredicateMetadata.
|
||||
type PredicatesStateData struct {
|
||||
Reference interface{}
|
||||
}
|
||||
|
||||
// Clone is supposed to make a copy of the data, but since this is just a pointer, we are practically
|
||||
// just copying the pointer. This is ok because the actual reference to the PredicateMetadata
|
||||
// copy that is made by generic_scheduler during preemption cycle will be injected again outside
|
||||
// the framework.
|
||||
func (p *PredicatesStateData) Clone() framework.StateData {
|
||||
return &PredicatesStateData{
|
||||
Reference: p.Reference,
|
||||
}
|
||||
}
|
||||
|
||||
// PrioritiesStateData is a pointer to PrioritiesMetadata.
|
||||
type PrioritiesStateData struct {
|
||||
Reference interface{}
|
||||
}
|
||||
|
||||
// Clone is supposed to make a copy of the data, but since this is just a pointer, we are practically
|
||||
// just copying the pointer.
|
||||
func (p *PrioritiesStateData) Clone() framework.StateData {
|
||||
return &PrioritiesStateData{
|
||||
Reference: p.Reference,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user