Skip to content

Commit ef34ba3

Browse files
committed
Disable image gc while ImageGCHighThreshold == 100
Signed-off-by: Mingjun Zhang <zmj-miss@live.com>
1 parent 853c367 commit ef34ba3

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

edge/pkg/edged/edged.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -747,13 +747,6 @@ func (e *edged) initializeModules() error {
747747
}
748748

749749
func (e *edged) StartGarbageCollection() {
750-
go utilwait.Until(func() {
751-
err := e.imageGCManager.GarbageCollect()
752-
if err != nil {
753-
klog.Errorf("Image garbage collection failed: %v", err)
754-
}
755-
}, ImageGCPeriod, utilwait.NeverStop)
756-
757750
go utilwait.Until(func() {
758751
if e.isInitPodReady() {
759752
err := e.containerGCManager.GarbageCollect()
@@ -762,6 +755,18 @@ func (e *edged) StartGarbageCollection() {
762755
}
763756
}
764757
}, ContainerGCPeriod, utilwait.NeverStop)
758+
759+
if edgedconfig.Config.ImageGCHighThreshold == 100 {
760+
klog.Infof("ImageGCHighThreshold is set 100, Disable image GC")
761+
return
762+
}
763+
764+
go utilwait.Until(func() {
765+
err := e.imageGCManager.GarbageCollect()
766+
if err != nil {
767+
klog.Errorf("Image garbage collection failed: %v", err)
768+
}
769+
}, ImageGCPeriod, utilwait.NeverStop)
765770
}
766771

767772
func (e *edged) syncLoopIteration(plegCh <-chan *pleg.PodLifecycleEvent, housekeepingCh <-chan time.Time, syncWorkQueueCh <-chan time.Time) {

0 commit comments

Comments
 (0)