Start for real background tasks in container manager.

Signed-off-by: Vishnu kannan <vishnuk@google.com>
This commit is contained in:
Vishnu kannan 2016-03-02 14:18:33 -08:00
parent ec77d0841d
commit f9129b02a5
2 changed files with 19 additions and 19 deletions

View File

@ -324,11 +324,7 @@ func (cm *containerManagerImpl) Start() error {
numEnsureStateFuncs++ numEnsureStateFuncs++
} }
} }
if numEnsureStateFuncs == 0 { if numEnsureStateFuncs >= 0 {
return nil
}
// Run ensure state functions every minute.
go wait.Until(func() { go wait.Until(func() {
for _, cont := range cm.systemContainers { for _, cont := range cm.systemContainers {
if cont.ensureStateFunc != nil { if cont.ensureStateFunc != nil {
@ -339,6 +335,10 @@ func (cm *containerManagerImpl) Start() error {
} }
}, time.Minute, wait.NeverStop) }, time.Minute, wait.NeverStop)
}
// Run ensure state functions every minute.
if len(cm.periodicTasks) > 0 {
go wait.Until(func() { go wait.Until(func() {
for _, task := range cm.periodicTasks { for _, task := range cm.periodicTasks {
if task != nil { if task != nil {
@ -346,6 +346,7 @@ func (cm *containerManagerImpl) Start() error {
} }
} }
}, 5*time.Minute, wait.NeverStop) }, 5*time.Minute, wait.NeverStop)
}
return nil return nil
} }

View File

@ -18,7 +18,6 @@ package kubelet
import ( import (
"bytes" "bytes"
"errors"
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
@ -923,7 +922,7 @@ func (kl *Kubelet) listPodsFromDisk() ([]types.UID, error) {
func (kl *Kubelet) GetNode() (*api.Node, error) { func (kl *Kubelet) GetNode() (*api.Node, error) {
if kl.standaloneMode { if kl.standaloneMode {
return nil, errors.New("no node entry for kubelet in standalone mode") return kl.initialNodeStatus()
} }
return kl.nodeInfo.GetNodeInfo(kl.nodeName) return kl.nodeInfo.GetNodeInfo(kl.nodeName)
} }