Remove the ReadyReplica version guard

This commit is contained in:
Kris 2016-12-15 11:14:38 -08:00
parent 32946c5bd0
commit 1d8bebeb2f

View File

@ -500,8 +500,6 @@ func WaitForPodsSuccess(c clientset.Interface, ns string, successPodLabels map[s
return nil return nil
} }
var ReadyReplicaVersion = utilversion.MustParseSemantic("v1.4.0")
// WaitForPodsRunningReady waits up to timeout to ensure that all pods in // WaitForPodsRunningReady waits up to timeout to ensure that all pods in
// namespace ns are either running and ready, or failed but controlled by a // namespace ns are either running and ready, or failed but controlled by a
// controller. Also, it ensures that at least minPods are running and // controller. Also, it ensures that at least minPods are running and
@ -517,12 +515,6 @@ var ReadyReplicaVersion = utilversion.MustParseSemantic("v1.4.0")
// means "Ready" or not. // means "Ready" or not.
// If skipSucceeded is true, any pods that are Succeeded are not counted. // If skipSucceeded is true, any pods that are Succeeded are not counted.
func WaitForPodsRunningReady(c clientset.Interface, ns string, minPods int32, timeout time.Duration, ignoreLabels map[string]string, skipSucceeded bool) error { func WaitForPodsRunningReady(c clientset.Interface, ns string, minPods int32, timeout time.Duration, ignoreLabels map[string]string, skipSucceeded bool) error {
// This can be removed when we no longer have 1.3 servers running with upgrade tests.
hasReadyReplicas, err := ServerVersionGTE(ReadyReplicaVersion, c.Discovery())
if err != nil {
Logf("Error getting the server version: %v", err)
return err
}
ignoreSelector := labels.SelectorFromSet(ignoreLabels) ignoreSelector := labels.SelectorFromSet(ignoreLabels)
start := time.Now() start := time.Now()
@ -545,7 +537,6 @@ func WaitForPodsRunningReady(c clientset.Interface, ns string, minPods int32, ti
// checked. // checked.
replicas, replicaOk := int32(0), int32(0) replicas, replicaOk := int32(0), int32(0)
if hasReadyReplicas {
rcList, err := c.Core().ReplicationControllers(ns).List(v1.ListOptions{}) rcList, err := c.Core().ReplicationControllers(ns).List(v1.ListOptions{})
if err != nil { if err != nil {
Logf("Error getting replication controllers in namespace '%s': %v", ns, err) Logf("Error getting replication controllers in namespace '%s': %v", ns, err)
@ -565,7 +556,6 @@ func WaitForPodsRunningReady(c clientset.Interface, ns string, minPods int32, ti
replicas += *rs.Spec.Replicas replicas += *rs.Spec.Replicas
replicaOk += rs.Status.ReadyReplicas replicaOk += rs.Status.ReadyReplicas
} }
}
podList, err := c.Core().Pods(ns).List(v1.ListOptions{}) podList, err := c.Core().Pods(ns).List(v1.ListOptions{})
if err != nil { if err != nil {
@ -605,9 +595,7 @@ func WaitForPodsRunningReady(c clientset.Interface, ns string, minPods int32, ti
Logf("%d / %d pods in namespace '%s' are running and ready (%d seconds elapsed)", Logf("%d / %d pods in namespace '%s' are running and ready (%d seconds elapsed)",
nOk, len(podList.Items), ns, int(time.Since(start).Seconds())) nOk, len(podList.Items), ns, int(time.Since(start).Seconds()))
if hasReadyReplicas {
Logf("expected %d pod replicas in namespace '%s', %d are Running and Ready.", replicas, ns, replicaOk) Logf("expected %d pod replicas in namespace '%s', %d are Running and Ready.", replicas, ns, replicaOk)
}
if replicaOk == replicas && nOk >= minPods && len(badPods) == 0 { if replicaOk == replicas && nOk >= minPods && len(badPods) == 0 {
return true, nil return true, nil