Skip to content

Commit

Permalink
Merge pull request kubernetes#31988 from pmorie/gc-log
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

Add positive logging for GC events

We have no positive logging for GC events.  This PR:

1.  Adds positive logging at V(4) for success cases
2.  Adds positive logging at V(1) for the first successful GC after a failure
  • Loading branch information
Kubernetes Submit Queue authored Sep 23, 2016
2 parents cba0c6f + bd83f8b commit 13a0ce6
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 @@ -1114,15 +1114,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 13a0ce6

Please sign in to comment.