mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Start for real background tasks in container manager.
Signed-off-by: Vishnu kannan <vishnuk@google.com>
This commit is contained in:
parent
ec77d0841d
commit
f9129b02a5
@ -324,28 +324,29 @@ func (cm *containerManagerImpl) Start() error {
|
||||
numEnsureStateFuncs++
|
||||
}
|
||||
}
|
||||
if numEnsureStateFuncs == 0 {
|
||||
return nil
|
||||
if numEnsureStateFuncs >= 0 {
|
||||
go wait.Until(func() {
|
||||
for _, cont := range cm.systemContainers {
|
||||
if cont.ensureStateFunc != nil {
|
||||
if err := cont.ensureStateFunc(cont.manager); err != nil {
|
||||
glog.Warningf("[ContainerManager] Failed to ensure state of %q: %v", cont.name, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, time.Minute, wait.NeverStop)
|
||||
|
||||
}
|
||||
|
||||
// Run ensure state functions every minute.
|
||||
go wait.Until(func() {
|
||||
for _, cont := range cm.systemContainers {
|
||||
if cont.ensureStateFunc != nil {
|
||||
if err := cont.ensureStateFunc(cont.manager); err != nil {
|
||||
glog.Warningf("[ContainerManager] Failed to ensure state of %q: %v", cont.name, err)
|
||||
if len(cm.periodicTasks) > 0 {
|
||||
go wait.Until(func() {
|
||||
for _, task := range cm.periodicTasks {
|
||||
if task != nil {
|
||||
task()
|
||||
}
|
||||
}
|
||||
}
|
||||
}, time.Minute, wait.NeverStop)
|
||||
|
||||
go wait.Until(func() {
|
||||
for _, task := range cm.periodicTasks {
|
||||
if task != nil {
|
||||
task()
|
||||
}
|
||||
}
|
||||
}, 5*time.Minute, wait.NeverStop)
|
||||
}, 5*time.Minute, wait.NeverStop)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ package kubelet
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@ -923,7 +922,7 @@ func (kl *Kubelet) listPodsFromDisk() ([]types.UID, error) {
|
||||
|
||||
func (kl *Kubelet) GetNode() (*api.Node, error) {
|
||||
if kl.standaloneMode {
|
||||
return nil, errors.New("no node entry for kubelet in standalone mode")
|
||||
return kl.initialNodeStatus()
|
||||
}
|
||||
return kl.nodeInfo.GetNodeInfo(kl.nodeName)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user