event recorder exposes involvedObjectRef for callers
lifecycle/rotten
Currently, we use the [event recorder](https://github.com/openshift/library-go/blob/6b235e9156fa65e7c61199a56cfdabecd2e08c59/pkg/operator/events/recorder.go#L19) to send our events, in some cases, we need to send an event in a Reconcile, and the event may have different `involvedObjectRef`, so we need to create new recorder in every Reconcile, but we have some concern to `Shutdown` the recorder when exiting the Reconcile, since the events are sent asynchronously, it seems hard to know whether the events are actually sent before calling the `Shutdown`.
So if the event recorder can provide some new methods like following that will be very helpful:
```
// Event emits the normal type event and allows passing the involved object.
func (r *recorder) EventWithInvolvedObjectRef(involvedObjectRef *corev1.ObjectReference, reason, message string)
// Warning emits the warning type event and allows passing the involved object..
func (r *recorder) WarningWithInvolvedObjectRef(involvedObjectRef *corev1.ObjectReference, reason, message string)
```
关闭于 2024-09-06 4 条评论