@@ -81,27 +81,27 @@ type EventSinkImpl struct {
81
81
}
82
82
83
83
// 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.
84
- func (e * EventSinkImpl ) Create (event * eventsv1.Event ) (* eventsv1.Event , error ) {
84
+ func (e * EventSinkImpl ) Create (ctx context. Context , event * eventsv1.Event ) (* eventsv1.Event , error ) {
85
85
if event .Namespace == "" {
86
86
return nil , fmt .Errorf ("can't create an event with empty namespace" )
87
87
}
88
- return e .Interface .Events (event .Namespace ).Create (context . TODO () , event , metav1.CreateOptions {})
88
+ return e .Interface .Events (event .Namespace ).Create (ctx , event , metav1.CreateOptions {})
89
89
}
90
90
91
91
// 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.
92
- func (e * EventSinkImpl ) Update (event * eventsv1.Event ) (* eventsv1.Event , error ) {
92
+ func (e * EventSinkImpl ) Update (ctx context. Context , event * eventsv1.Event ) (* eventsv1.Event , error ) {
93
93
if event .Namespace == "" {
94
94
return nil , fmt .Errorf ("can't update an event with empty namespace" )
95
95
}
96
- return e .Interface .Events (event .Namespace ).Update (context . TODO () , event , metav1.UpdateOptions {})
96
+ return e .Interface .Events (event .Namespace ).Update (ctx , event , metav1.UpdateOptions {})
97
97
}
98
98
99
99
// Patch applies the patch and returns the patched event, and an error, if there is any.
100
- func (e * EventSinkImpl ) Patch (event * eventsv1.Event , data []byte ) (* eventsv1.Event , error ) {
100
+ func (e * EventSinkImpl ) Patch (ctx context. Context , event * eventsv1.Event , data []byte ) (* eventsv1.Event , error ) {
101
101
if event .Namespace == "" {
102
102
return nil , fmt .Errorf ("can't patch an event with empty namespace" )
103
103
}
104
- return e .Interface .Events (event .Namespace ).Patch (context . TODO () , event .Name , types .StrategicMergePatchType , data , metav1.PatchOptions {})
104
+ return e .Interface .Events (event .Namespace ).Patch (ctx , event .Name , types .StrategicMergePatchType , data , metav1.PatchOptions {})
105
105
}
106
106
107
107
// NewBroadcaster Creates a new event broadcaster.
@@ -237,13 +237,13 @@ func recordEvent(ctx context.Context, sink EventSink, event *eventsv1.Event) (*e
237
237
klog .FromContext (ctx ).Error (patchBytesErr , "Unable to calculate diff, no merge is possible" )
238
238
return nil , false
239
239
}
240
- newEvent , err = sink .Patch (event , patch )
240
+ newEvent , err = sink .Patch (ctx , event , patch )
241
241
}
242
242
// Update can fail because the event may have been removed and it no longer exists.
243
243
if ! isEventSeries || (isEventSeries && util .IsKeyNotFoundError (err )) {
244
244
// Making sure that ResourceVersion is empty on creation
245
245
event .ResourceVersion = ""
246
- newEvent , err = sink .Create (event )
246
+ newEvent , err = sink .Create (ctx , event )
247
247
}
248
248
if err == nil {
249
249
return newEvent , false
0 commit comments