diff --git a/pkg/controller/volume/attachdetach/populator/desired_state_of_world_populator.go b/pkg/controller/volume/attachdetach/populator/desired_state_of_world_populator.go index 819e04be22be2..f1abbb0a4c967 100644 --- a/pkg/controller/volume/attachdetach/populator/desired_state_of_world_populator.go +++ b/pkg/controller/volume/attachdetach/populator/desired_state_of_world_populator.go @@ -82,12 +82,26 @@ func (dswp *desiredStateOfWorldPopulator) findAndRemoveDeletedPods() { glog.Errorf("MetaNamespaceKeyFunc failed for pod %q (UID %q) with: %v", dswPodKey, dswPodUID, err) continue } - // retrieve the pod object from pod informer with the namespace key - informerPodObj, exists, err := dswp.podInformer.GetStore().GetByKey(dswPodKey) - if err != nil || informerPodObj == nil { - glog.Errorf("podInformer GetByKey failed for pod %q (UID %q) with %v", dswPodKey, dswPodUID, err) + + // Retrieve the pod object from pod informer with the namespace key + informerPodObj, exists, err := + dswp.podInformer.GetStore().GetByKey(dswPodKey) + if err != nil { + glog.Errorf( + "podInformer GetByKey failed for pod %q (UID %q) with %v", + dswPodKey, + dswPodUID, + err) continue } + if exists && informerPodObj == nil { + glog.Info( + "podInformer GetByKey found pod, but informerPodObj is nil for pod %q (UID %q)", + dswPodKey, + dswPodUID) + continue + } + if exists { informerPod, ok := informerPodObj.(*api.Pod) if !ok { @@ -95,7 +109,7 @@ func (dswp *desiredStateOfWorldPopulator) findAndRemoveDeletedPods() { continue } informerPodUID := volumehelper.GetUniquePodName(informerPod) - // Check whether the unique idenfier of the pod from dsw matches the one retrived from pod informer + // Check whether the unique identifier of the pod from dsw matches the one retrieved from pod informer if informerPodUID == dswPodUID { glog.V(10).Infof( "Verified pod %q (UID %q) from dsw exists in pod informer.", dswPodKey, dswPodUID) @@ -103,7 +117,7 @@ func (dswp *desiredStateOfWorldPopulator) findAndRemoveDeletedPods() { } } - // the pod from dsw does not exist in pod informer, or it does not match the unique idenfier retrieved + // the pod from dsw does not exist in pod informer, or it does not match the unique identifer retrieved // from the informer, delete it from dsw glog.V(1).Infof( "Removing pod %q (UID %q) from dsw because it does not exist in pod informer.", dswPodKey, dswPodUID)