mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #35623 from gmarek/meta
Automatic merge from submit-queue Scheduler Reduce functions can use PriorityMetadata
This commit is contained in:
		@@ -78,7 +78,7 @@ func CalculateNodeAffinityPriorityMap(pod *api.Pod, meta interface{}, nodeInfo *
 | 
				
			|||||||
	}, nil
 | 
						}, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func CalculateNodeAffinityPriorityReduce(pod *api.Pod, result schedulerapi.HostPriorityList) error {
 | 
					func CalculateNodeAffinityPriorityReduce(pod *api.Pod, meta interface{}, result schedulerapi.HostPriorityList) error {
 | 
				
			||||||
	var maxCount int
 | 
						var maxCount int
 | 
				
			||||||
	for i := range result {
 | 
						for i := range result {
 | 
				
			||||||
		if result[i].Score > maxCount {
 | 
							if result[i].Score > maxCount {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -88,7 +88,7 @@ func ComputeTaintTolerationPriorityMap(pod *api.Pod, meta interface{}, nodeInfo
 | 
				
			|||||||
	}, nil
 | 
						}, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func ComputeTaintTolerationPriorityReduce(pod *api.Pod, result schedulerapi.HostPriorityList) error {
 | 
					func ComputeTaintTolerationPriorityReduce(pod *api.Pod, meta interface{}, result schedulerapi.HostPriorityList) error {
 | 
				
			||||||
	var maxCount int
 | 
						var maxCount int
 | 
				
			||||||
	for i := range result {
 | 
						for i := range result {
 | 
				
			||||||
		if result[i].Score > maxCount {
 | 
							if result[i].Score > maxCount {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,7 +51,7 @@ func priorityFunction(mapFn algorithm.PriorityMapFunction, reduceFn algorithm.Pr
 | 
				
			|||||||
			result = append(result, hostResult)
 | 
								result = append(result, hostResult)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if reduceFn != nil {
 | 
							if reduceFn != nil {
 | 
				
			||||||
			if err := reduceFn(pod, result); err != nil {
 | 
								if err := reduceFn(pod, nil, result); err != nil {
 | 
				
			||||||
				return nil, err
 | 
									return nil, err
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,7 +36,7 @@ type PriorityMapFunction func(pod *api.Pod, meta interface{}, nodeInfo *schedule
 | 
				
			|||||||
// final scores for all nodes.
 | 
					// final scores for all nodes.
 | 
				
			||||||
// TODO: Figure out the exact API of this method.
 | 
					// TODO: Figure out the exact API of this method.
 | 
				
			||||||
// TODO: Change interface{} to a specific type.
 | 
					// TODO: Change interface{} to a specific type.
 | 
				
			||||||
type PriorityReduceFunction func(pod *api.Pod, result schedulerapi.HostPriorityList) error
 | 
					type PriorityReduceFunction func(pod *api.Pod, meta interface{}, result schedulerapi.HostPriorityList) error
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// MetdataProducer is a function that computes metadata for a given pod.
 | 
					// MetdataProducer is a function that computes metadata for a given pod.
 | 
				
			||||||
type MetadataProducer func(pod *api.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo) interface{}
 | 
					type MetadataProducer func(pod *api.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo) interface{}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -315,7 +315,7 @@ func PrioritizeNodes(
 | 
				
			|||||||
		wg.Add(1)
 | 
							wg.Add(1)
 | 
				
			||||||
		go func(index int, config algorithm.PriorityConfig) {
 | 
							go func(index int, config algorithm.PriorityConfig) {
 | 
				
			||||||
			defer wg.Done()
 | 
								defer wg.Done()
 | 
				
			||||||
			if err := config.Reduce(pod, results[index]); err != nil {
 | 
								if err := config.Reduce(pod, meta, results[index]); err != nil {
 | 
				
			||||||
				appendError(err)
 | 
									appendError(err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}(i, priorityConfig)
 | 
							}(i, priorityConfig)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user