Implemented taints and tolerations priority function as a Score plugin

This commit is contained in:
Abdullah Gharaibeh
2019-10-05 20:31:51 -04:00
parent 46dd075bab
commit 7429b0fe86
17 changed files with 510 additions and 88 deletions

View File

@@ -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
}