Merge pull request #20942 from Random-Liu/fix-bug-in-sync-loop

Auto commit by PR queue bot
pull/6/head
k8s-merge-robot 2016-02-09 20:24:02 -08:00
commit b97214304c
1 changed files with 14 additions and 2 deletions

View File

@ -2360,8 +2360,20 @@ func (kl *Kubelet) syncLoopIteration(updates <-chan kubetypes.PodUpdate, handler
case update := <-kl.livenessManager.Updates(): case update := <-kl.livenessManager.Updates():
// We only care about failures (signalling container death) here. // We only care about failures (signalling container death) here.
if update.Result == proberesults.Failure { if update.Result == proberesults.Failure {
glog.V(1).Infof("SyncLoop (container unhealthy): %q", format.Pod(update.Pod)) // We should not use the pod from livenessManager, because it is never updated after
handler.HandlePodSyncs([]*api.Pod{update.Pod}) // initialization.
// TODO(random-liu): This is just a quick fix. We should:
// * Just pass pod UID in probe updates to make this less confusing.
// * Maybe probe manager should rely on pod manager, or at least the pod in probe manager
// should be updated.
pod, ok := kl.podManager.GetPodByUID(update.Pod.UID)
if !ok {
// If the pod no longer exists, ignore the update.
glog.V(4).Infof("SyncLoop (container unhealthy): ignore irrelevant update: %#v", update)
break
}
glog.V(1).Infof("SyncLoop (container unhealthy): %q", format.Pod(pod))
handler.HandlePodSyncs([]*api.Pod{pod})
} }
case <-housekeepingCh: case <-housekeepingCh:
if !kl.allSourcesReady() { if !kl.allSourcesReady() {