mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +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:
parent
46fe7f062b
commit
1b0f981f82
@ -321,21 +321,21 @@ func (rc *ResourceConsumer) GetReplicas() int {
|
|||||||
if replicationController == nil {
|
if replicationController == nil {
|
||||||
framework.Failf(rcIsNil)
|
framework.Failf(rcIsNil)
|
||||||
}
|
}
|
||||||
return int(replicationController.Status.Replicas)
|
return int(replicationController.Status.ReadyReplicas)
|
||||||
case KindDeployment:
|
case KindDeployment:
|
||||||
deployment, err := rc.framework.ClientSet.Extensions().Deployments(rc.framework.Namespace.Name).Get(rc.name, metav1.GetOptions{})
|
deployment, err := rc.framework.ClientSet.Extensions().Deployments(rc.framework.Namespace.Name).Get(rc.name, metav1.GetOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
if deployment == nil {
|
if deployment == nil {
|
||||||
framework.Failf(deploymentIsNil)
|
framework.Failf(deploymentIsNil)
|
||||||
}
|
}
|
||||||
return int(deployment.Status.Replicas)
|
return int(deployment.Status.ReadyReplicas)
|
||||||
case KindReplicaSet:
|
case KindReplicaSet:
|
||||||
rs, err := rc.framework.ClientSet.Extensions().ReplicaSets(rc.framework.Namespace.Name).Get(rc.name, metav1.GetOptions{})
|
rs, err := rc.framework.ClientSet.Extensions().ReplicaSets(rc.framework.Namespace.Name).Get(rc.name, metav1.GetOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
if rs == nil {
|
if rs == nil {
|
||||||
framework.Failf(rsIsNil)
|
framework.Failf(rsIsNil)
|
||||||
}
|
}
|
||||||
return int(rs.Status.Replicas)
|
return int(rs.Status.ReadyReplicas)
|
||||||
default:
|
default:
|
||||||
framework.Failf(invalidKind)
|
framework.Failf(invalidKind)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user