Skip to content

Commit

Permalink
Add positive logging for GC events
Browse files Browse the repository at this point in the history
  • Loading branch information
pmorie committed Sep 2, 2016
1 parent e693a61 commit bd83f8b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -1083,15 +1083,35 @@ func (kl *Kubelet) listPodsFromDisk() ([]types.UID, error) {

// Starts garbage collection threads.
func (kl *Kubelet) StartGarbageCollection() {
loggedContainerGCFailure := false
go wait.Until(func() {
if err := kl.containerGC.GarbageCollect(kl.sourcesReady.AllReady()); err != nil {
glog.Errorf("Container garbage collection failed: %v", err)
loggedContainerGCFailure = true
} else {
var vLevel glog.Level = 4
if loggedContainerGCFailure {
vLevel = 1
loggedContainerGCFailure = false
}

glog.V(vLevel).Infof("Container garbage collection succeeded")
}
}, ContainerGCPeriod, wait.NeverStop)

loggedImageGCFailure := false
go wait.Until(func() {
if err := kl.imageManager.GarbageCollect(); err != nil {
glog.Errorf("Image garbage collection failed: %v", err)
loggedImageGCFailure = true
} else {
var vLevel glog.Level = 4
if loggedImageGCFailure {
vLevel = 1
loggedImageGCFailure = false
}

glog.V(vLevel).Infof("Image garbage collection succeeded")
}
}, ImageGCPeriod, wait.NeverStop)
}
Expand Down

0 comments on commit bd83f8b

Please sign in to comment.