mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #92448 from oomichi/cleanup-getScheduledAndUnscheduledPods
Remove ns from getScheduledAndUnscheduledPods()
This commit is contained in:
commit
e9bb71c091
@ -44,7 +44,7 @@ func SIGDescribe(text string, body func()) bool {
|
|||||||
func WaitForStableCluster(c clientset.Interface, workerNodes sets.String) int {
|
func WaitForStableCluster(c clientset.Interface, workerNodes sets.String) int {
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
// Wait for all pods to be scheduled.
|
// Wait for all pods to be scheduled.
|
||||||
allScheduledPods, allNotScheduledPods := getScheduledAndUnscheduledPods(c, workerNodes, metav1.NamespaceAll)
|
allScheduledPods, allNotScheduledPods := getScheduledAndUnscheduledPods(c, workerNodes)
|
||||||
for len(allNotScheduledPods) != 0 {
|
for len(allNotScheduledPods) != 0 {
|
||||||
time.Sleep(waitTime)
|
time.Sleep(waitTime)
|
||||||
if startTime.Add(timeout).Before(time.Now()) {
|
if startTime.Add(timeout).Before(time.Now()) {
|
||||||
@ -55,7 +55,7 @@ func WaitForStableCluster(c clientset.Interface, workerNodes sets.String) int {
|
|||||||
framework.Failf("Timed out after %v waiting for stable cluster.", timeout)
|
framework.Failf("Timed out after %v waiting for stable cluster.", timeout)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
allScheduledPods, allNotScheduledPods = getScheduledAndUnscheduledPods(c, workerNodes, metav1.NamespaceAll)
|
allScheduledPods, allNotScheduledPods = getScheduledAndUnscheduledPods(c, workerNodes)
|
||||||
}
|
}
|
||||||
return len(allScheduledPods)
|
return len(allScheduledPods)
|
||||||
}
|
}
|
||||||
@ -78,10 +78,11 @@ func WaitForPodsToBeDeleted(c clientset.Interface) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// getScheduledAndUnscheduledPods lists scheduled and not scheduled pods in the given namespace, with succeeded and failed pods filtered out.
|
// getScheduledAndUnscheduledPods lists scheduled and not scheduled pods in all namespaces, with succeeded and failed pods filtered out.
|
||||||
func getScheduledAndUnscheduledPods(c clientset.Interface, workerNodes sets.String, ns string) (scheduledPods, notScheduledPods []v1.Pod) {
|
func getScheduledAndUnscheduledPods(c clientset.Interface, workerNodes sets.String) (scheduledPods, notScheduledPods []v1.Pod) {
|
||||||
pods, err := c.CoreV1().Pods(ns).List(context.TODO(), metav1.ListOptions{})
|
pods, err := c.CoreV1().Pods(metav1.NamespaceAll).List(context.TODO(), metav1.ListOptions{})
|
||||||
framework.ExpectNoError(err, fmt.Sprintf("listing all pods in namespace %q while waiting for stable cluster", ns))
|
framework.ExpectNoError(err, fmt.Sprintf("listing all pods in namespace %q while waiting for stable cluster", metav1.NamespaceAll))
|
||||||
|
|
||||||
// API server returns also Pods that succeeded. We need to filter them out.
|
// API server returns also Pods that succeeded. We need to filter them out.
|
||||||
filteredPods := make([]v1.Pod, 0, len(pods.Items))
|
filteredPods := make([]v1.Pod, 0, len(pods.Items))
|
||||||
for _, p := range pods.Items {
|
for _, p := range pods.Items {
|
||||||
|
Loading…
Reference in New Issue
Block a user