Merge pull request #31958 from ZTE-PaaS/zhangke-patch-034

Automatic merge from submit-queue

Redundant code process for container_mananger start

1. need not sum the total numEnsureStateFuncs
2. numEnsureStateFuncs should > 0, otherwise, calculate numEnsureStateFuncs would be not neccessary
This commit is contained in:
Kubernetes Submit Queue 2016-09-11 17:48:55 -07:00 committed by GitHub
commit c49d8360ec

View File

@ -466,13 +466,14 @@ func (cm *containerManagerImpl) Start(node *api.Node) error {
return err return err
} }
// Don't run a background thread if there are no ensureStateFuncs. // Don't run a background thread if there are no ensureStateFuncs.
numEnsureStateFuncs := 0 hasEnsureStateFuncs := false
for _, cont := range cm.systemContainers { for _, cont := range cm.systemContainers {
if cont.ensureStateFunc != nil { if cont.ensureStateFunc != nil {
numEnsureStateFuncs++ hasEnsureStateFuncs = true
break
} }
} }
if numEnsureStateFuncs >= 0 { if hasEnsureStateFuncs {
// Run ensure state functions every minute. // Run ensure state functions every minute.
go wait.Until(func() { go wait.Until(func() {
for _, cont := range cm.systemContainers { for _, cont := range cm.systemContainers {