Change PDB tests to use pod conditions instead of phase

This commit is contained in:
Morten Torkildsen 2019-12-17 12:45:42 -08:00
parent 0b830f3d68
commit 81a6cf2847

View File

@ -31,6 +31,7 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/util/retry"
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
"k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image"
)
@ -314,8 +315,9 @@ func waitForPodsOrDie(cs kubernetes.Interface, ns string, n int) {
return false, nil
}
ready := 0
for i := 0; i < n; i++ {
if pods.Items[i].Status.Phase == v1.PodRunning {
for i := range pods.Items {
pod := pods.Items[i]
if podutil.IsPodReady(&pod) {
ready++
}
}
@ -373,8 +375,9 @@ func locateRunningPod(cs kubernetes.Interface, ns string) (pod *v1.Pod, err erro
}
for i := range podList.Items {
if podList.Items[i].Status.Phase == v1.PodRunning {
pod = &podList.Items[i]
p := podList.Items[i]
if podutil.IsPodReady(&p) {
pod = &p
return true, nil
}
}