Implemented taints and tolerations priority function as a Score plugin
This commit is contained in:
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package migration
|
||||
|
||||
import (
|
||||
"k8s.io/klog"
|
||||
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
|
||||
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
||||
)
|
||||
@@ -88,3 +89,18 @@ func (p *PrioritiesStateData) Clone() framework.StateData {
|
||||
Reference: p.Reference,
|
||||
}
|
||||
}
|
||||
|
||||
// PriorityMetadata returns priority metadata stored in CycleState.
|
||||
func PriorityMetadata(state *framework.CycleState) interface{} {
|
||||
if state == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var meta interface{}
|
||||
if s, err := state.Read(PrioritiesStateKey); err == nil {
|
||||
meta = s.(*PrioritiesStateData).Reference
|
||||
} else {
|
||||
klog.Errorf("reading key %q from CycleState, continuing without metadata: %v", PrioritiesStateKey, err)
|
||||
}
|
||||
return meta
|
||||
}
|
||||
|
Reference in New Issue
Block a user