Use small letter var definition

This commit is contained in:
zhengguoyong 2015-11-16 12:06:02 +08:00
parent 96ae38c036
commit b18a9baacc

View File

@ -28,10 +28,10 @@ import (
) )
const ( const (
RunOnceManifestDelay = 1 * time.Second runOnceManifestDelay = 1 * time.Second
RunOnceMaxRetries = 10 runOnceMaxRetries = 10
RunOnceRetryDelay = 1 * time.Second runOnceRetryDelay = 1 * time.Second
RunOnceRetryDelayBackoff = 2 runOnceRetryDelayBackoff = 2
) )
type RunPodResult struct { type RunPodResult struct {
@ -44,11 +44,11 @@ func (kl *Kubelet) RunOnce(updates <-chan kubetypes.PodUpdate) ([]RunPodResult,
select { select {
case u := <-updates: case u := <-updates:
glog.Infof("processing manifest with %d pods", len(u.Pods)) glog.Infof("processing manifest with %d pods", len(u.Pods))
result, err := kl.runOnce(u.Pods, RunOnceRetryDelay) result, err := kl.runOnce(u.Pods, runOnceRetryDelay)
glog.Infof("finished processing %d pods", len(u.Pods)) glog.Infof("finished processing %d pods", len(u.Pods))
return result, err return result, err
case <-time.After(RunOnceManifestDelay): case <-time.After(runOnceManifestDelay):
return nil, fmt.Errorf("no pod manifest update after %v", RunOnceManifestDelay) return nil, fmt.Errorf("no pod manifest update after %v", runOnceManifestDelay)
} }
} }
@ -113,14 +113,14 @@ func (kl *Kubelet) runPod(pod *api.Pod, retryDelay time.Duration) error {
if err = kl.syncPod(pod, nil, p, kubetypes.SyncPodUpdate); err != nil { if err = kl.syncPod(pod, nil, p, kubetypes.SyncPodUpdate); err != nil {
return fmt.Errorf("error syncing pod: %v", err) return fmt.Errorf("error syncing pod: %v", err)
} }
if retry >= RunOnceMaxRetries { if retry >= runOnceMaxRetries {
return fmt.Errorf("timeout error: pod %q containers not running after %d retries", pod.Name, RunOnceMaxRetries) return fmt.Errorf("timeout error: pod %q containers not running after %d retries", pod.Name, runOnceMaxRetries)
} }
// TODO(proppy): health checking would be better than waiting + checking the state at the next iteration. // TODO(proppy): health checking would be better than waiting + checking the state at the next iteration.
glog.Infof("pod %q containers synced, waiting for %v", pod.Name, delay) glog.Infof("pod %q containers synced, waiting for %v", pod.Name, delay)
time.Sleep(delay) time.Sleep(delay)
retry++ retry++
delay *= RunOnceRetryDelayBackoff delay *= runOnceRetryDelayBackoff
} }
} }