Skip to content

Commit 136ee23

Browse files
committed
Remove StartEventWatcher call
The StartEventWatcher call is no longer needed since calling StartRecordingToSink already sets up a watcher and manages it via its context. Signed-off-by: Borja Clemente <[email protected]>
1 parent 0528c33 commit 136ee23

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

pkg/internal/recorder/recorder.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"sync"
2424

2525
"github.com/go-logr/logr"
26-
eventsv1 "k8s.io/api/events/v1"
2726
"k8s.io/apimachinery/pkg/runtime"
2827
eventsv1client "k8s.io/client-go/kubernetes/typed/events/v1"
2928
"k8s.io/client-go/rest"
@@ -96,17 +95,7 @@ func (p *Provider) getBroadcaster() events.EventBroadcaster {
9695
p.broadcaster = events.NewBroadcaster(&events.EventSinkImpl{Interface: p.evtClient})
9796
}
9897
// TODO(clebs): figure out how to manage the context/channel that StartRecordingToSink needs inside the provider.
99-
p.broadcaster.StartRecordingToSink(nil)
100-
101-
// TODO(clebs): figure out if we still need this and how the change would make sense.
102-
p.broadcaster.StartEventWatcher(
103-
func(obj runtime.Object) {
104-
if e, ok := obj.(*eventsv1.Event); ok {
105-
p.logger.V(1).Info(e.Note, "type", e.Type, "object", e.Regarding, "related", e.Related, "reason", e.Reason)
106-
} else {
107-
p.logger.V(1).Info("event watcher received an unsupported object type", "gvk", obj.GetObjectKind().GroupVersionKind().String())
108-
}
109-
})
98+
p.broadcaster.StartRecordingToSinkWithContext(context.TODO())
11099
})
111100

112101
return p.broadcaster

0 commit comments

Comments
 (0)