Change:
Chronically failing test. Perhaps covers deprecated behavior? /sig scalability /assign
shows up in
/sig scheduling is one of scheduling e2e test.
/assign I'll check this one.
According to the log, the balanced pods were not created by scheduler, the cpu/mem usage was unchanged.
This test failing every other run. Fix or disable? Blocking 1.7?
similar to , move to 1.8, but I'll still working on that.

Discussion:
err := framework.CheckTestingNSDeletedExcept(cs, ns) framework.ExpectNoError(err) err = framework.WaitForPodsRunningReady(cs, metav1.NamespaceSystem, int32(systemPodsNo), 0, framework.PodReadyBeforeTimeout, ignoreLabels) Expect(err).NotTo(HaveOccurred()) })

defer framework.RemoveLabelOffNode(cs, nodeName, k) // make the nodes have balanced cpu,mem usage ratio <del> createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.6) </del> <ins> err := createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.6) framework.ExpectNoError(err) </ins> By("Trying to relaunch the pod, now with labels.") labelPodName := "pod-with-node-affinity" pod := createPausePod(f, pausePodConfig{

framework.AddOrUpdateLabelOnNode(cs, nodeName, k, v) framework.ExpectNodeHasLabel(cs, nodeName, k, v) defer framework.RemoveLabelOffNode(cs, nodeName, k) // make the nodes have balanced cpu,mem usage <del> createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.6) </del> <ins> err := createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.6) framework.ExpectNoError(err) </ins> By("Trying to launch the pod, now with podAffinity.") labelPodName := "pod-with-podaffinity" pod = createPausePod(f, pausePodConfig{

framework.AddOrUpdateLabelOnNode(cs, nodeName, k, v) framework.ExpectNodeHasLabel(cs, nodeName, k, v) defer framework.RemoveLabelOffNode(cs, nodeName, k) // make the nodes have balanced cpu,mem usage <del> createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.6) </del> <ins> err := createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.6) framework.ExpectNoError(err) </ins> By("Trying to launch the pod with podAntiAffinity.") labelPodName := "pod-with-pod-antiaffinity" pod = createPausePod(f, pausePodConfig{

It("Pod should avoid to schedule to node that have avoidPod annotation", func() { nodeName := nodeList.Items[0].Name // make the nodes have balanced cpu,mem usage <del> createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.5) </del> <ins> err := createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.5) framework.ExpectNoError(err) </ins> By("Create a RC, with 0 replicas") rc := createRC(ns, "scheduler-priority-avoid-pod", int32(0), map[string]string{"name": "scheduler-priority-avoid-pod"}, f, podRequestedResource) // Cleanup the replication controller when we are done.

It("Pod should perfer to scheduled to nodes pod can tolerate", func() { // make the nodes have balanced cpu,mem usage ratio <del> createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.5) </del> <ins> err := createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.5) framework.ExpectNoError(err) </ins> //we need apply more taints on a node, because one match toleration only count 1 By("Trying to apply 10 taint on the nodes except first one.") nodeName := nodeList.Items[0].Name

}) // createBalancedPodForNodes creates a pod per node that asks for enough resources to make all nodes have the same mem/cpu usage ratio. <del> func createBalancedPodForNodes(f *framework.Framework, cs clientset.Interface, ns string, nodes []v1.Node, requestedResource *v1.ResourceRequirements, ratio float64) { </del> <ins> func createBalancedPodForNodes(f *framework.Framework, cs clientset.Interface, ns string, nodes []v1.Node, requestedResource *v1.ResourceRequirements, ratio float64) error { </ins> // find the max, if the node has the max,use the one, if not,use the ratio parameter <del> var maxCpuFraction, maxMemFraction float64 = ratio, ratio </del> <ins> var maxCPUFraction, maxMemFraction float64 = ratio, ratio </ins> var cpuFractionMap = make(map[string]float64) var memFractionMap = make(map[string]float64) for _, node := range nodes { cpuFraction, memFraction := computeCpuMemFraction(cs, node, requestedResource) cpuFractionMap[node.Name] = cpuFraction memFractionMap[node.Name] = memFraction <del> if cpuFraction > maxCpuFraction { maxCpuFraction = cpuFraction </del> <ins> if cpuFraction > maxCPUFraction { maxCPUFraction = cpuFraction </ins> } if memFraction > maxMemFraction { maxMemFraction = memFraction } } // we need the max one to keep the same cpu/mem use rate <del> ratio = math.Max(maxCpuFraction, maxMemFraction) </del> <ins> ratio = math.Max(maxCPUFraction, maxMemFraction) </ins> for _, node := range nodes { memAllocatable, found := node.Status.Allocatable["memory"] Expect(found).To(Equal(true))

needCreateResource["memory"] = *resource.NewQuantity(int64((ratio-memFraction)*float64(memAllocatableVal)), resource.BinarySI) <del> testutils.StartPods(cs, 1, ns, "priority-balanced-mem-"+node.Name, </del> <ins> err := testutils.StartPods(cs, 1, ns, "priority-balanced-mem-"+node.Name, </ins> *initPausePod(f, pausePodConfig{ Name:   "", Labels: balancePodLabel,

}, NodeName: node.Name, }), true, framework.Logf) <ins> if err != nil { return err } </ins> } for _, node := range nodes { By("Compute Cpu, Mem Fraction after create balanced pods.") computeCpuMemFraction(cs, node, requestedResource) } <ins> return nil </ins> } func computeCpuMemFraction(cs clientset.Interface, node v1.Node, resource *v1.ResourceRequirements) (float64, float64) {