mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Remove the ReadyReplica version guard
This commit is contained in:
parent
32946c5bd0
commit
1d8bebeb2f
@ -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,26 +537,24 @@ 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)
|
return false, nil
|
||||||
return false, nil
|
}
|
||||||
}
|
for _, rc := range rcList.Items {
|
||||||
for _, rc := range rcList.Items {
|
replicas += *rc.Spec.Replicas
|
||||||
replicas += *rc.Spec.Replicas
|
replicaOk += rc.Status.ReadyReplicas
|
||||||
replicaOk += rc.Status.ReadyReplicas
|
}
|
||||||
}
|
|
||||||
|
|
||||||
rsList, err := c.Extensions().ReplicaSets(ns).List(v1.ListOptions{})
|
rsList, err := c.Extensions().ReplicaSets(ns).List(v1.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Logf("Error getting replication sets in namespace %q: %v", ns, err)
|
Logf("Error getting replication sets in namespace %q: %v", ns, err)
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
for _, rs := range rsList.Items {
|
for _, rs := range rsList.Items {
|
||||||
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{})
|
||||||
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user