Reduce reaper poll interval and wait while resizing

When reaping a replication controller that handles an arbitrary amount of replicas, missing an interval means that `kubectl stop|delete` have to wait 3 more seconds to finish which seems more expensive from a user pov than a GET per 100ms.

Also I think `kubectl resize` should wait for all replicas to spin up before exiting. Feels more safe to know that your replication controller status is up to date.
This commit is contained in:
kargakis
2015-05-19 16:07:58 +02:00
parent a615799488
commit 99655b342f
2 changed files with 8 additions and 13 deletions

View File

@@ -26,9 +26,8 @@ import (
)
const (
shortInterval = time.Millisecond * 100
interval = time.Second * 3
timeout = time.Minute * 5
Interval = time.Millisecond * 100
Timeout = time.Second * 20
)
// A Reaper handles terminating an object as gracefully as possible.
@@ -52,7 +51,7 @@ func IsNoSuchReaperError(err error) bool {
func ReaperFor(kind string, c client.Interface) (Reaper, error) {
switch kind {
case "ReplicationController":
return &ReplicationControllerReaper{c, interval, timeout}, nil
return &ReplicationControllerReaper{c, Interval, Timeout}, nil
case "Pod":
return &PodReaper{c}, nil
case "Service":
@@ -83,8 +82,8 @@ func (reaper *ReplicationControllerReaper) Stop(namespace, name string, gracePer
if err != nil {
return "", err
}
retry := &RetryParams{shortInterval, reaper.timeout}
waitForReplicas := &RetryParams{reaper.pollInterval, reaper.timeout}
retry := NewRetryParams(reaper.pollInterval, reaper.timeout)
waitForReplicas := NewRetryParams(reaper.pollInterval, reaper.timeout)
if err = resizer.Resize(namespace, name, 0, nil, retry, waitForReplicas); err != nil {
return "", err
}