func GetFieldSelector(eventsGroupVersion schema.GroupVersion, regardingGroupVersionKind schema.GroupVersionKind, regardingName string, regardingUID types.UID) (fields.Selector, error)
GetFieldSelector returns the appropriate field selector based on the API version being used to communicate with the server. The returned field selector can be used with List and Watch to filter desired events.
EventBroadcaster knows how to receive events and send them to any EventSink, watcher, or log.
type EventBroadcaster interface { // StartRecordingToSink starts sending events received from the specified eventBroadcaster. // Deprecated: use StartRecordingToSinkWithContext instead. StartRecordingToSink(stopCh <-chan struct{}) // StartRecordingToSink starts sending events received from the specified eventBroadcaster. StartRecordingToSinkWithContext(ctx context.Context) error // NewRecorder returns an EventRecorder that can be used to send events to this EventBroadcaster // with the event source set to the given event source. NewRecorder(scheme *runtime.Scheme, reportingController string) EventRecorderLogger // StartEventWatcher enables you to watch for emitted events without usage // of StartRecordingToSink. This lets you also process events in a custom way (e.g. in tests). // NOTE: events received on your eventHandler should be copied before being used. // TODO: figure out if this can be removed. StartEventWatcher(eventHandler func(event runtime.Object)) (func(), error) // StartStructuredLogging starts sending events received from this EventBroadcaster to the structured // logging function. The return value can be ignored or used to stop recording, if desired. // Deprecated: use StartLogging instead. StartStructuredLogging(verbosity klog.Level) func() // StartLogging starts sending events received from this EventBroadcaster to the structured logger. // To adjust verbosity, use the logger's V method (i.e. pass `logger.V(3)` instead of `logger`). // The returned function can be ignored or used to stop recording, if desired. StartLogging(logger klog.Logger) (func(), error) // Shutdown shuts down the broadcaster Shutdown() }
func NewBroadcaster(sink EventSink) EventBroadcaster
NewBroadcaster Creates a new event broadcaster.
EventBroadcasterAdapter is a auxiliary interface to simplify migration to the new events API. It is a wrapper around new and legacy broadcasters that smartly chooses which one to use.
Deprecated: This interface will be removed once migration is completed.
type EventBroadcasterAdapter interface { // StartRecordingToSink starts sending events received from the specified eventBroadcaster. StartRecordingToSink(stopCh <-chan struct{}) // NewRecorder creates a new Event Recorder with specified name. NewRecorder(name string) EventRecorderLogger // DeprecatedNewLegacyRecorder creates a legacy Event Recorder with specific name. DeprecatedNewLegacyRecorder(name string) record.EventRecorderLogger // Shutdown shuts down the broadcaster. Shutdown() }
func NewEventBroadcasterAdapter(client clientset.Interface) EventBroadcasterAdapter
NewEventBroadcasterAdapter creates a wrapper around new and legacy broadcasters to simplify migration of individual components to the new Event API.
func NewEventBroadcasterAdapterWithContext(ctx context.Context, client clientset.Interface) EventBroadcasterAdapter
NewEventBroadcasterAdapterWithContext creates a wrapper around new and legacy broadcasters to simplify migration of individual components to the new Event API.
type EventRecorder = internalevents.EventRecorder
type EventRecorderLogger = internalevents.EventRecorderLogger
EventSink knows how to store events (client-go implements it.) EventSink must respect the namespace that will be embedded in 'event'. It is assumed that EventSink will return the same sorts of errors as client-go's REST client.
type EventSink interface { Create(ctx context.Context, event *eventsv1.Event) (*eventsv1.Event, error) Update(ctx context.Context, event *eventsv1.Event) (*eventsv1.Event, error) Patch(ctx context.Context, oldEvent *eventsv1.Event, data []byte) (*eventsv1.Event, error) }
EventSinkImpl wraps EventsV1Interface to implement EventSink. TODO: this makes it easier for testing purpose and masks the logic of performing API calls. Note that rollbacking to raw clientset should also be transparent.
type EventSinkImpl struct { Interface typedeventsv1.EventsV1Interface }
func (e *EventSinkImpl) Create(ctx context.Context, event *eventsv1.Event) (*eventsv1.Event, error)
Create takes the representation of a event and creates it. Returns the server's representation of the event, and an error, if there is any.
func (e *EventSinkImpl) Patch(ctx context.Context, event *eventsv1.Event, data []byte) (*eventsv1.Event, error)
Patch applies the patch and returns the patched event, and an error, if there is any.
func (e *EventSinkImpl) Update(ctx context.Context, event *eventsv1.Event) (*eventsv1.Event, error)
Update takes the representation of a event and updates it. Returns the server's representation of the event, and an error, if there is any.
FakeRecorder is used as a fake during tests. It is thread safe. It is usable when created manually and not by NewFakeRecorder, however all events may be thrown away in this case.
type FakeRecorder struct { Events chan string }
func NewFakeRecorder(bufferSize int) *FakeRecorder
NewFakeRecorder creates new fake event recorder with event channel with buffer of given size.
func (f *FakeRecorder) Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{})
Eventf emits an event
func (f *FakeRecorder) WithLogger(logger klog.Logger) EventRecorderLogger