Merge pull request #56388 from CaoShuFeng/failureDomain
Automatic merge from submit-queue (batch tested with PRs 56308, 54304, 56364, 56388, 55853). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. clean up failure domain from InterPodAffinityPriority **Release note**: ```release-note NONE ```
This commit is contained in:
		@@ -27,7 +27,6 @@ go_library(
 | 
			
		||||
    importpath = "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/priorities",
 | 
			
		||||
    deps = [
 | 
			
		||||
        "//pkg/apis/core/v1/helper:go_default_library",
 | 
			
		||||
        "//pkg/kubelet/apis:go_default_library",
 | 
			
		||||
        "//pkg/util/node:go_default_library",
 | 
			
		||||
        "//plugin/pkg/scheduler/algorithm:go_default_library",
 | 
			
		||||
        "//plugin/pkg/scheduler/algorithm/predicates:go_default_library",
 | 
			
		||||
 
 | 
			
		||||
@@ -17,14 +17,12 @@ limitations under the License.
 | 
			
		||||
package priorities
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"strings"
 | 
			
		||||
	"sync"
 | 
			
		||||
 | 
			
		||||
	"k8s.io/api/core/v1"
 | 
			
		||||
	apierrors "k8s.io/apimachinery/pkg/api/errors"
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
	"k8s.io/client-go/util/workqueue"
 | 
			
		||||
	kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis"
 | 
			
		||||
	"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm"
 | 
			
		||||
	"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/predicates"
 | 
			
		||||
	priorityutil "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/priorities/util"
 | 
			
		||||
@@ -63,8 +61,6 @@ type podAffinityPriorityMap struct {
 | 
			
		||||
	// counts store the mapping from node name to so-far computed score of
 | 
			
		||||
	// the node.
 | 
			
		||||
	counts map[string]float64
 | 
			
		||||
	// failureDomains contain default failure domains keys
 | 
			
		||||
	failureDomains priorityutil.Topologies
 | 
			
		||||
	// The first error that we faced.
 | 
			
		||||
	firstError error
 | 
			
		||||
}
 | 
			
		||||
@@ -73,7 +69,6 @@ func newPodAffinityPriorityMap(nodes []*v1.Node) *podAffinityPriorityMap {
 | 
			
		||||
	return &podAffinityPriorityMap{
 | 
			
		||||
		nodes:  nodes,
 | 
			
		||||
		counts: make(map[string]float64, len(nodes)),
 | 
			
		||||
		failureDomains: priorityutil.Topologies{DefaultKeys: strings.Split(kubeletapis.DefaultFailureDomains, ",")},
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -98,7 +93,7 @@ func (p *podAffinityPriorityMap) processTerm(term *v1.PodAffinityTerm, podDefini
 | 
			
		||||
			p.Lock()
 | 
			
		||||
			defer p.Unlock()
 | 
			
		||||
			for _, node := range p.nodes {
 | 
			
		||||
				if p.failureDomains.NodesHaveSameTopologyKey(node, fixedNode, term.TopologyKey) {
 | 
			
		||||
				if priorityutil.NodesHaveSameTopologyKey(node, fixedNode, term.TopologyKey) {
 | 
			
		||||
					p.counts[node.Name] += weight
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user