fix bug for garbage collection

This commit is contained in:
jiaxuanzhou 2018-07-11 08:55:56 +08:00
parent ff9a66bd17
commit 6ac4a8588e

View File

@ -1238,12 +1238,10 @@ func (kl *Kubelet) StartGarbageCollection() {
} }
}, ContainerGCPeriod, wait.NeverStop) }, ContainerGCPeriod, wait.NeverStop)
stopChan := make(chan struct{})
defer close(stopChan)
// when the high threshold is set to 100, stub the image GC manager // when the high threshold is set to 100, stub the image GC manager
if kl.kubeletConfiguration.ImageGCHighThresholdPercent == 100 { if kl.kubeletConfiguration.ImageGCHighThresholdPercent == 100 {
glog.V(2).Infof("ImageGCHighThresholdPercent is set 100, Disable image GC") glog.V(2).Infof("ImageGCHighThresholdPercent is set 100, Disable image GC")
go func() { stopChan <- struct{}{} }() return
} }
prevImageGCFailed := false prevImageGCFailed := false
@ -1266,7 +1264,7 @@ func (kl *Kubelet) StartGarbageCollection() {
glog.V(vLevel).Infof("Image garbage collection succeeded") glog.V(vLevel).Infof("Image garbage collection succeeded")
} }
}, ImageGCPeriod, stopChan) }, ImageGCPeriod, wait.NeverStop)
} }
// initializeModules will initialize internal modules that do not require the container runtime to be up. // initializeModules will initialize internal modules that do not require the container runtime to be up.