Increase GC timeout for RCs bigger than 40k

pull/6/head
gmarek 2016-09-05 10:11:18 +02:00
parent 2cc5923ed6
commit d990720c12
1 changed files with 10 additions and 7 deletions

View File

@ -163,6 +163,10 @@ const (
// Number of times we want to retry Updates in case of conflict // Number of times we want to retry Updates in case of conflict
UpdateRetries = 5 UpdateRetries = 5
// Number of objects that gc can delete in a second.
// GC issues 2 requestes for single delete.
gcThroughput = 10
) )
var ( var (
@ -3354,17 +3358,16 @@ func DeleteRCAndWaitForGC(c *client.Client, ns, name string) error {
var interval, timeout time.Duration var interval, timeout time.Duration
switch { switch {
case rc.Spec.Replicas < 100: case rc.Spec.Replicas < 100:
interval = 10 * time.Millisecond interval = 100 * time.Millisecond
timeout = 10 * time.Minute
case rc.Spec.Replicas < 1000: case rc.Spec.Replicas < 1000:
interval = 1 * time.Second interval = 1 * time.Second
timeout = 10 * time.Minute
case rc.Spec.Replicas < 10000:
interval = 10 * time.Second
timeout = 10 * time.Minute
default: default:
interval = 10 * time.Second interval = 10 * time.Second
timeout = 40 * time.Minute }
if rc.Spec.Replicas < 5000 {
timeout = 10 * time.Minute
} else {
timeout = time.Duration(rc.Spec.Replicas / gcThroughput)
} }
err = waitForPodsInactive(ps, interval, timeout) err = waitForPodsInactive(ps, interval, timeout)
if err != nil { if err != nil {