image: use deletion handling metanamespace key in import scheduler
@@ -47,7 +47,11 @@ func (s *ScheduledImageStreamController) Importing(stream *imageapi.ImageStream)
}
glog.V(5).Infof("DEBUG: stream %s was just imported", stream.Name)
// Push the current key back to the end of the queue because it's just been imported
- key, _ := cache.MetaNamespaceKeyFunc(stream)
+ key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(stream)
+ if err != nil {
+ utilruntime.HandleError(fmt.Errorf("failed to get the key for stream %s: %v", stream.Name, err))
+ return
+ }
s.scheduler.Delay(key)
}
@@ -92,22 +96,9 @@ func (s *ScheduledImageStreamController) updateImageStream(old, cur interface{})
}
func (s *ScheduledImageStreamController) deleteImageStream(obj interface{}) {
- stream, isStream := obj.(*imageapi.ImageStream)
- if !isStream {
- tombstone, objIsTombstone := obj.(cache.DeletedFinalStateUnknown)
- if !objIsTombstone {
- return
- }
- var isImageStream bool
- stream, isImageStream = tombstone.Obj.(*imageapi.ImageStream)
- if !isImageStream {
- glog.V(2).Infof("tombstone contained unexpected object %#v", tombstone)
- return
- }
- }
- key, err := cache.MetaNamespaceKeyFunc(stream)
+ key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
if err != nil {
- glog.V(2).Infof("unable to get namespace key function for stream %s/%s: %v", stream.Namespace, stream.Name, err)
+ utilruntime.HandleError(fmt.Errorf("unable to get namespace key for %#v", obj))
return
}
s.scheduler.Remove(key, nil)
@@ -119,7 +110,7 @@ func (s *ScheduledImageStreamController) enqueueImageStream(stream *imageapi.Ima
return
}
if needsScheduling(stream) {
- key, err := cache.MetaNamespaceKeyFunc(stream)
+ key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(stream)
if err != nil {
glog.V(2).Infof("unable to get namespace key function for stream %s/%s: %v", stream.Namespace, stream.Name, err)
return
