Since you ask about sending events, you should use an EventRecorder
.
The approach to get an event recorder as documented in book-v1 used to be
mgr.GetRecorder("containerset-controller")
However, an equivalent doc doesn't seem to exist in the updated v3 documentation any more. The new alternative is:
mgr.GetEventRecorderFor("containerset-controller")
e.g.
func newReconciler(mgr manager.Manager) reconcile.Reconciler {
return &ReconcileContainerSet{
Client: mgr.GetClient(),
scheme: mgr.GetScheme(),
recorder: mgr.GetEventRecorderFor("containerset-controller"),
}
}
the resulting record.EventRecorder
can be used in your reconciler like before:
recorder.Event(&obj, apiv1.EventTypeNormal, "Created", "something was created")
However, the quoted extract
"How to batch multiple events into a single reconciliation call".
Is referring to something quite different; namely this:
reconcile.Requests for the same Name / Namespace are batched and deduplicated when they are enqueued. This allows
Controllers to gracefully handle a high volume of events for a single object. Multiplexing multiple event Sources to
a single object Type will batch requests across events for different object types.