@@ -225,7 +225,7 @@ func (c *Controller) processNextWorkItem(ctx context.Context) bool {
225
225
// there was a failure so be sure to report it. This method allows for
226
226
// pluggable error handling which can be used for things like
227
227
// cluster-monitoring.
228
- utilruntime .HandleErrorWithContext (ctx , err , "error syncing; requeuing" , "objectReference" , objRef )
228
+ utilruntime .HandleErrorWithContext (ctx , err , "Error syncing; requeuing for later retry " , "objectReference" , objRef )
229
229
// since we failed, we should requeue the item to work on later. This
230
230
// method will add a backoff to avoid hotlooping on particular items
231
231
// (they're probably still not going to work right away) and overall
@@ -247,7 +247,7 @@ func (c *Controller) syncHandler(ctx context.Context, objectRef cache.ObjectName
247
247
// The Foo resource may no longer exist, in which case we stop
248
248
// processing.
249
249
if errors .IsNotFound (err ) {
250
- utilruntime .HandleError ( fmt . Errorf ( "foo '%#v' in work queue no longer exists" , objectRef ) )
250
+ utilruntime .HandleErrorWithContext ( ctx , err , "Foo referenced by item in work queue no longer exists" , "objectReference" , objectRef )
251
251
return nil
252
252
}
253
253
@@ -259,7 +259,7 @@ func (c *Controller) syncHandler(ctx context.Context, objectRef cache.ObjectName
259
259
// We choose to absorb the error here as the worker would requeue the
260
260
// resource otherwise. Instead, the next time the resource is updated
261
261
// the resource will be queued again.
262
- utilruntime .HandleError ( fmt . Errorf ( "%#v: deployment name must be specified " , objectRef ) )
262
+ utilruntime .HandleErrorWithContext ( ctx , nil , "Deployment name missing from object reference " , "objectReference" , objectRef )
263
263
return nil
264
264
}
265
265
@@ -349,12 +349,16 @@ func (c *Controller) handleObject(obj interface{}) {
349
349
if object , ok = obj .(metav1.Object ); ! ok {
350
350
tombstone , ok := obj .(cache.DeletedFinalStateUnknown )
351
351
if ! ok {
352
- utilruntime .HandleError (fmt .Errorf ("error decoding object, invalid type" ))
352
+ // If the object value is not too big and does not contain sensitive information then
353
+ // it may be useful to include it.
354
+ utilruntime .HandleErrorWithContext (context .Background (), nil , "Error decoding object, invalid type" , "type" , fmt .Sprintf ("%T" , obj ))
353
355
return
354
356
}
355
357
object , ok = tombstone .Obj .(metav1.Object )
356
358
if ! ok {
357
- utilruntime .HandleError (fmt .Errorf ("error decoding object tombstone, invalid type" ))
359
+ // If the object value is not too big and does not contain sensitive information then
360
+ // it may be useful to include it.
361
+ utilruntime .HandleErrorWithContext (context .Background (), nil , "Error decoding object tombstone, invalid type" , "type" , fmt .Sprintf ("%T" , tombstone .Obj ))
358
362
return
359
363
}
360
364
logger .V (4 ).Info ("Recovered deleted object" , "resourceName" , object .GetName ())
0 commit comments