|
@@ -356,6 +356,58 @@ func (h *HTTPExtender) Prioritize(pod *v1.Pod, nodes []*v1.Node) (*schedulerapi.
|
|
return &result, h.weight, nil
|
|
return &result, h.weight, nil
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//------------------------------------------------------------------------------------------------
|
|
|
|
+//------------------------------------------------------------------------------------------------
|
|
|
|
+// ---------START OF CUSTOMIZATION------------------------------------------------------------------
|
|
|
|
+//------------------------------------------------------------------------------------------------
|
|
|
|
+//------------------------------------------------------------------------------------------------
|
|
|
|
+func (h *HTTPExtender) CustomPrioritize(pod *v1.Pod, nodes []*v1.Node) (*schedulerapi.CustomHostPriorityList, int, error) {
|
|
|
|
+ var (
|
|
|
|
+ result schedulerapi.CustomHostPriorityList
|
|
|
|
+ nodeList *v1.NodeList
|
|
|
|
+ nodeNames *[]string
|
|
|
|
+ args *schedulerapi.ExtenderArgs
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ if h.prioritizeVerb == "" {
|
|
|
|
+ result := schedulerapi.CustomHostPriorityList{}
|
|
|
|
+ for _, node := range nodes {
|
|
|
|
+ result = append(result, schedulerapi.CustomHostPriority{Host: node.Name, Score: 0})
|
|
|
|
+ }
|
|
|
|
+ return &result, 0, nil
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if h.nodeCacheCapable {
|
|
|
|
+ nodeNameSlice := make([]string, 0, len(nodes))
|
|
|
|
+ for _, node := range nodes {
|
|
|
|
+ nodeNameSlice = append(nodeNameSlice, node.Name)
|
|
|
|
+ }
|
|
|
|
+ nodeNames = &nodeNameSlice
|
|
|
|
+ } else {
|
|
|
|
+ nodeList = &v1.NodeList{}
|
|
|
|
+ for _, node := range nodes {
|
|
|
|
+ nodeList.Items = append(nodeList.Items, *node)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ args = &schedulerapi.ExtenderArgs{
|
|
|
|
+ Pod: pod,
|
|
|
|
+ Nodes: nodeList,
|
|
|
|
+ NodeNames: nodeNames,
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if err := h.send(h.prioritizeVerb, args, &result); err != nil {
|
|
|
|
+ return nil, 0, err
|
|
|
|
+ }
|
|
|
|
+ return &result, h.weight, nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//------------------------------------------------------------------------------------------------
|
|
|
|
+//------------------------------------------------------------------------------------------------
|
|
|
|
+// ---------END OF CUSTOMIZATION------------------------------------------------------------------
|
|
|
|
+//------------------------------------------------------------------------------------------------
|
|
|
|
+//------------------------------------------------------------------------------------------------
|
|
|
|
+
|
|
// Bind delegates the action of binding a pod to a node to the extender.
|
|
// Bind delegates the action of binding a pod to a node to the extender.
|
|
func (h *HTTPExtender) Bind(binding *v1.Binding) error {
|
|
func (h *HTTPExtender) Bind(binding *v1.Binding) error {
|
|
var result schedulerapi.ExtenderBindingResult
|
|
var result schedulerapi.ExtenderBindingResult
|