Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move inter-pod affinity predicate and priority functions from default to non-default due to negative performance effects even when not using the feature #25313

Merged
merged 1 commit into from
May 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 18 additions & 18 deletions plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@ func init() {
factory.RegisterFitPredicate("HostName", predicates.PodFitsHost)
// Fit is determined by node selector query.
factory.RegisterFitPredicate("MatchNodeSelector", predicates.PodSelectorMatches)
// Fit is determined by inter-pod affinity.
factory.RegisterFitPredicateFactory(
"MatchInterPodAffinity",
func(args factory.PluginFactoryArgs) algorithm.FitPredicate {
return predicates.NewPodAffinityPredicate(args.NodeInfo, args.PodLister, args.FailureDomains)
},
)
//pods should be placed in the same topological domain (e.g. same node, same rack, same zone, same power domain, etc.)
//as some other pods, or, conversely, should not be placed in the same topological domain as some other pods.
factory.RegisterPriorityConfigFactory(
"InterPodAffinityPriority",
factory.PriorityConfigFactory{
Function: func(args factory.PluginFactoryArgs) algorithm.PriorityFunction {
return priorities.NewInterPodAffinityPriority(args.NodeInfo, args.NodeLister, args.PodLister, args.HardPodAffinitySymmetricWeight, args.FailureDomains)
},
Weight: 1,
},
)
}

func defaultPredicates() sets.String {
Expand Down Expand Up @@ -127,13 +145,6 @@ func defaultPredicates() sets.String {
// GeneralPredicates are the predicates that are enforced by all Kubernetes components
// (e.g. kubelet and all schedulers)
factory.RegisterFitPredicate("GeneralPredicates", predicates.GeneralPredicates),
// Fit is determined by inter-pod affinity.
factory.RegisterFitPredicateFactory(
"MatchInterPodAffinity",
func(args factory.PluginFactoryArgs) algorithm.FitPredicate {
return predicates.NewPodAffinityPredicate(args.NodeInfo, args.PodLister, args.FailureDomains)
},
),
)
}

Expand Down Expand Up @@ -162,16 +173,5 @@ func defaultPriorities() sets.String {
Weight: 1,
},
),
//pods should be placed in the same topological domain (e.g. same node, same rack, same zone, same power domain, etc.)
//as some other pods, or, conversely, should not be placed in the same topological domain as some other pods.
factory.RegisterPriorityConfigFactory(
"InterPodAffinityPriority",
factory.PriorityConfigFactory{
Function: func(args factory.PluginFactoryArgs) algorithm.PriorityFunction {
return priorities.NewInterPodAffinityPriority(args.NodeInfo, args.NodeLister, args.PodLister, args.HardPodAffinitySymmetricWeight, args.FailureDomains)
},
Weight: 1,
},
),
)
}
10 changes: 5 additions & 5 deletions test/e2e/scheduler_predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
})

// Test Nodes does not have any pod, hence it should be impossible to schedule a Pod with pod affinity.
It("validates that Inter-pod-Affinity is respected if not matching", func() {
It("validates that Inter-pod-Affinity is respected if not matching [Feature:PodAffinity]", func() {
By("Trying to schedule Pod with nonempty Pod Affinity.")
podName := "without-label-" + string(util.NewUUID())

Expand Down Expand Up @@ -831,7 +831,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
})

// test the pod affinity successful matching scenario.
It("validates that InterPodAffinity is respected if matching", func() {
It("validates that InterPodAffinity is respected if matching [Feature:PodAffinity]", func() {
// launch a pod to find a node which can launch a pod. We intentionally do
// not just take the node list and choose the first of them. Depending on the
// cluster and the scheduler it might be that a "normal" pod cannot be
Expand Down Expand Up @@ -923,7 +923,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
})

// test when the pod anti affinity rule is not satisfied, the pod would stay pending.
It("validates that InterPodAntiAffinity is respected if matching", func() {
It("validates that InterPodAntiAffinity is respected if matching 2 [Feature:PodAffinity]", func() {
// launch a pod to find a node which can launch a pod. We intentionally do
// not just take the node list and choose the first of them. Depending on the
// cluster and the scheduler it might be that a "normal" pod cannot be
Expand Down Expand Up @@ -1011,7 +1011,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
})

// test the pod affinity successful matching scenario with multiple Label Operators.
It("validates that InterPodAffinity is respected if matching with multiple Affinities", func() {
It("validates that InterPodAffinity is respected if matching with multiple Affinities [Feature:PodAffinity]", func() {
// launch a pod to find a node which can launch a pod. We intentionally do
// not just take the node list and choose the first of them. Depending on the
// cluster and the scheduler it might be that a "normal" pod cannot be
Expand Down Expand Up @@ -1111,7 +1111,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
})

// test the pod affinity and anti affinity successful matching scenario.
It("validates that InterPod Affinity and AntiAffinity is respected if matching", func() {
It("validates that InterPod Affinity and AntiAffinity is respected if matching [Feature:PodAffinity]", func() {
// launch a pod to find a node which can launch a pod. We intentionally do
// not just take the node list and choose the first of them. Depending on the
// cluster and the scheduler it might be that a "normal" pod cannot be
Expand Down