mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-05 11:12:03 +00:00
Made the GetReplicas function count only ready replicas.
Counting all replicas makes functions dependent on GetReplicas proceed with trying to use replicas that are not ready yet.
This commit is contained in:
@@ -321,21 +321,21 @@ func (rc *ResourceConsumer) GetReplicas() int {
|
||||
if replicationController == nil {
|
||||
framework.Failf(rcIsNil)
|
||||
}
|
||||
return int(replicationController.Status.Replicas)
|
||||
return int(replicationController.Status.ReadyReplicas)
|
||||
case KindDeployment:
|
||||
deployment, err := rc.framework.ClientSet.Extensions().Deployments(rc.framework.Namespace.Name).Get(rc.name, metav1.GetOptions{})
|
||||
framework.ExpectNoError(err)
|
||||
if deployment == nil {
|
||||
framework.Failf(deploymentIsNil)
|
||||
}
|
||||
return int(deployment.Status.Replicas)
|
||||
return int(deployment.Status.ReadyReplicas)
|
||||
case KindReplicaSet:
|
||||
rs, err := rc.framework.ClientSet.Extensions().ReplicaSets(rc.framework.Namespace.Name).Get(rc.name, metav1.GetOptions{})
|
||||
framework.ExpectNoError(err)
|
||||
if rs == nil {
|
||||
framework.Failf(rsIsNil)
|
||||
}
|
||||
return int(rs.Status.Replicas)
|
||||
return int(rs.Status.ReadyReplicas)
|
||||
default:
|
||||
framework.Failf(invalidKind)
|
||||
}
|
||||
|
Reference in New Issue
Block a user