mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +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++
|
numEnsureStateFuncs++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if numEnsureStateFuncs == 0 {
|
if numEnsureStateFuncs >= 0 {
|
||||||
return nil
|
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.
|
// Run ensure state functions every minute.
|
||||||
go wait.Until(func() {
|
if len(cm.periodicTasks) > 0 {
|
||||||
for _, cont := range cm.systemContainers {
|
go wait.Until(func() {
|
||||||
if cont.ensureStateFunc != nil {
|
for _, task := range cm.periodicTasks {
|
||||||
if err := cont.ensureStateFunc(cont.manager); err != nil {
|
if task != nil {
|
||||||
glog.Warningf("[ContainerManager] Failed to ensure state of %q: %v", cont.name, err)
|
task()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}, 5*time.Minute, wait.NeverStop)
|
||||||
}, time.Minute, wait.NeverStop)
|
}
|
||||||
|
|
||||||
go wait.Until(func() {
|
|
||||||
for _, task := range cm.periodicTasks {
|
|
||||||
if task != nil {
|
|
||||||
task()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 5*time.Minute, wait.NeverStop)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user