// We retry by default. RetryWatcher is meant to proceed unless it is certain
// that it can't. If we are not certain, we proceed with retry and leave it
// up to the user to timeout if needed.
// Log here so we have a record of hitting the unexpected error
// and we can whitelist some error codes if we missed any that are expected.
klog.V(5).Info(spew.Sprintf("Retrying after unexpected error: %#+v",event.Object))
// Retry
returnfalse,statusDelay
}
default:
klog.Errorf("Failed to recognize Event type %q",event.Type)
_=rw.send(watch.Event{
Type:watch.Error,
Object:&apierrors.NewInternalError(fmt.Errorf("retryWatcher failed to recognize Event type %q",event.Type)).ErrStatus,
})
// We are unable to restart the watch and have to stop the loop or this might cause lastResourceVersion inconsistency by skipping a potential RV with valid data!
returntrue,0
}
}
}
}
// receive reads the result from a watcher, restarting it if necessary.