mirror of https://github.com/k3s-io/k3s
Merge pull request #6860 from wojtek-t/retry_density_test
Retry on error in while stopping replication controller in Density testpull/6/head
commit
a4d0ed899a
|
@ -60,8 +60,19 @@ func DeleteRC(c *client.Client, ns, name string) error {
|
|||
return fmt.Errorf("Failed to resize replication controller %s to zero: %v", name, err)
|
||||
}
|
||||
|
||||
if err := wait.Poll(time.Second, time.Minute*20, client.ControllerHasDesiredReplicas(c, rc)); err != nil {
|
||||
return fmt.Errorf("Error waiting for replication controller %s replicas to reach 0: %v", name, err)
|
||||
// Wait up to 20 minutes until all replicas are killed.
|
||||
endTime := time.Now().Add(time.Minute * 20)
|
||||
for {
|
||||
if time.Now().After(endTime) {
|
||||
return fmt.Errorf("Timeout while waiting for replication controller %s replicas to 0", name)
|
||||
}
|
||||
remainingTime := endTime.Sub(time.Now())
|
||||
err := wait.Poll(time.Second, remainingTime, client.ControllerHasDesiredReplicas(c, rc))
|
||||
if err != nil {
|
||||
glog.Errorf("Error while waiting for replication controller %s replicas to read 0: %v", name, err)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the replication controller.
|
||||
|
|
Loading…
Reference in New Issue