Skip to content

Commit e9bb71c

Browse files
authored
Merge pull request kubernetes#92448 from oomichi/cleanup-getScheduledAndUnscheduledPods
Remove ns from getScheduledAndUnscheduledPods()
2 parents 4fc5c1e + dac8f75 commit e9bb71c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/e2e/scheduling/framework.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func SIGDescribe(text string, body func()) bool {
4444
func WaitForStableCluster(c clientset.Interface, workerNodes sets.String) int {
4545
startTime := time.Now()
4646
// Wait for all pods to be scheduled.
47-
allScheduledPods, allNotScheduledPods := getScheduledAndUnscheduledPods(c, workerNodes, metav1.NamespaceAll)
47+
allScheduledPods, allNotScheduledPods := getScheduledAndUnscheduledPods(c, workerNodes)
4848
for len(allNotScheduledPods) != 0 {
4949
time.Sleep(waitTime)
5050
if startTime.Add(timeout).Before(time.Now()) {
@@ -55,7 +55,7 @@ func WaitForStableCluster(c clientset.Interface, workerNodes sets.String) int {
5555
framework.Failf("Timed out after %v waiting for stable cluster.", timeout)
5656
break
5757
}
58-
allScheduledPods, allNotScheduledPods = getScheduledAndUnscheduledPods(c, workerNodes, metav1.NamespaceAll)
58+
allScheduledPods, allNotScheduledPods = getScheduledAndUnscheduledPods(c, workerNodes)
5959
}
6060
return len(allScheduledPods)
6161
}
@@ -78,10 +78,11 @@ func WaitForPodsToBeDeleted(c clientset.Interface) {
7878
}
7979
}
8080

81-
// getScheduledAndUnscheduledPods lists scheduled and not scheduled pods in the given namespace, with succeeded and failed pods filtered out.
82-
func getScheduledAndUnscheduledPods(c clientset.Interface, workerNodes sets.String, ns string) (scheduledPods, notScheduledPods []v1.Pod) {
83-
pods, err := c.CoreV1().Pods(ns).List(context.TODO(), metav1.ListOptions{})
84-
framework.ExpectNoError(err, fmt.Sprintf("listing all pods in namespace %q while waiting for stable cluster", ns))
81+
// getScheduledAndUnscheduledPods lists scheduled and not scheduled pods in all namespaces, with succeeded and failed pods filtered out.
82+
func getScheduledAndUnscheduledPods(c clientset.Interface, workerNodes sets.String) (scheduledPods, notScheduledPods []v1.Pod) {
83+
pods, err := c.CoreV1().Pods(metav1.NamespaceAll).List(context.TODO(), metav1.ListOptions{})
84+
framework.ExpectNoError(err, fmt.Sprintf("listing all pods in namespace %q while waiting for stable cluster", metav1.NamespaceAll))
85+
8586
// API server returns also Pods that succeeded. We need to filter them out.
8687
filteredPods := make([]v1.Pod, 0, len(pods.Items))
8788
for _, p := range pods.Items {

0 commit comments

Comments
 (0)