Move fallback of Event API into new event lib

Kubernetes-commit: e0e12f25c9ccd33f5578fddef79d93eb7b62ea0c
This commit is contained in:
Chelsey Chen
2020-06-04 21:36:04 -04:00
committed by Kubernetes Publisher
parent 18c1ef0354
commit a8a31f0d9b
2 changed files with 77 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ package events
import (
"k8s.io/api/events/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/record"
)
// EventRecorder knows how to record events on behalf of an EventSource.
@@ -68,3 +69,22 @@ type EventSink interface {
Update(event *v1beta1.Event) (*v1beta1.Event, error)
Patch(oldEvent *v1beta1.Event, data []byte) (*v1beta1.Event, error)
}
// 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) EventRecorder
// DeprecatedNewLegacyRecorder creates a legacy Event Recorder with specific name.
DeprecatedNewLegacyRecorder(name string) record.EventRecorder
// Shutdown shuts down the broadcaster.
Shutdown()
}