Switch event recorder to use events.k8s.io/v1

This commit is contained in:
Chelsey Chen
2020-06-16 18:25:18 -04:00
parent 6cedc0853f
commit ade2422883
16 changed files with 130 additions and 119 deletions

View File

@@ -85,7 +85,7 @@ func setupScheduler(
informerFactory informers.SharedInformerFactory,
) {
eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{
Interface: cs.EventsV1beta1().Events(""),
Interface: cs.EventsV1(),
})
sched, err := scheduler.New(

View File

@@ -65,17 +65,17 @@ func TestEventCompatibility(t *testing.T) {
oldBroadcaster.StartRecordingToSink(&typedv1.EventSinkImpl{Interface: client.CoreV1().Events("")})
oldRecorder.Eventf(regarding, v1.EventTypeNormal, "started", "note")
newBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{Interface: client.EventsV1beta1().Events("")})
newBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{Interface: client.EventsV1()})
newRecorder := newBroadcaster.NewRecorder(scheme.Scheme, "k8s.io/kube-scheduler")
newBroadcaster.StartRecordingToSink(stopCh)
newRecorder.Eventf(regarding, related, v1.EventTypeNormal, "memoryPressure", "killed", "memory pressure")
err = wait.PollImmediate(100*time.Millisecond, 20*time.Second, func() (done bool, err error) {
v1beta1Events, err := client.EventsV1beta1().Events("").List(context.TODO(), metav1.ListOptions{})
v1Events, err := client.EventsV1().Events("").List(context.TODO(), metav1.ListOptions{})
if err != nil {
return false, err
}
if len(v1beta1Events.Items) != 2 {
if len(v1Events.Items) != 2 {
return false, nil
}

View File

@@ -269,7 +269,7 @@ priorities: []
policyConfigMap.APIVersion = "v1"
clientSet.CoreV1().ConfigMaps(metav1.NamespaceSystem).Create(context.TODO(), &policyConfigMap, metav1.CreateOptions{})
eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{Interface: clientSet.EventsV1beta1().Events("")})
eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{Interface: clientSet.EventsV1()})
stopCh := make(chan struct{})
eventBroadcaster.StartRecordingToSink(stopCh)
@@ -323,7 +323,7 @@ func TestSchedulerCreationFromNonExistentConfigMap(t *testing.T) {
informerFactory := informers.NewSharedInformerFactory(clientSet, 0)
eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{Interface: clientSet.EventsV1beta1().Events("")})
eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{Interface: clientSet.EventsV1()})
stopCh := make(chan struct{})
eventBroadcaster.StartRecordingToSink(stopCh)

View File

@@ -80,7 +80,7 @@ func StartScheduler(clientSet clientset.Interface) (*scheduler.Scheduler, corein
informerFactory := informers.NewSharedInformerFactory(clientSet, 0)
podInformer := informerFactory.Core().V1().Pods()
evtBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{
Interface: clientSet.EventsV1beta1().Events("")})
Interface: clientSet.EventsV1()})
evtBroadcaster.StartRecordingToSink(ctx.Done())
@@ -401,7 +401,7 @@ func InitTestSchedulerWithOptions(
}
var err error
eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{
Interface: testCtx.ClientSet.EventsV1beta1().Events(""),
Interface: testCtx.ClientSet.EventsV1(),
})
if policy != nil {

View File

@@ -105,7 +105,7 @@ func initTestSchedulerWithOptions(
podInformer := testCtx.informerFactory.Core().V1().Pods()
eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{
Interface: testCtx.clientSet.EventsV1beta1().Events(""),
Interface: testCtx.clientSet.EventsV1(),
})
var err error