MCPcopy
hub / github.com/kubernetes/client-go / generateEvent

Method generateEvent

tools/record/event.go:293–313  ·  view source on GitHub ↗
(object runtime.Object, annotations map[string]string, timestamp metav1.Time, eventtype, reason, message string)

Source from the content-addressed store, hash-verified

291}
292
293func (recorder *recorderImpl) generateEvent(object runtime.Object, annotations map[string]string, timestamp metav1.Time, eventtype, reason, message string) {
294 ref, err := ref.GetReference(recorder.scheme, object)
295 if err != nil {
296 klog.Errorf("Could not construct reference to: '%#v' due to: '%v'. Will not report event: '%v' '%v' '%v'", object, err, eventtype, reason, message)
297 return
298 }
299
300 if !util.ValidateEventType(eventtype) {
301 klog.Errorf("Unsupported event type: '%v'", eventtype)
302 return
303 }
304
305 event := recorder.makeEvent(ref, annotations, eventtype, reason, message)
306 event.Source = recorder.source
307
308 go func() {
309 // NOTE: events should be a non-blocking operation
310 defer utilruntime.HandleCrash()
311 recorder.Action(watch.Added, event)
312 }()
313}
314
315func (recorder *recorderImpl) Event(object runtime.Object, eventtype, reason, message string) {
316 recorder.generateEvent(object, nil, metav1.Now(), eventtype, reason, message)

Callers 3

EventMethod · 0.95
PastEventfMethod · 0.95
AnnotatedEventfMethod · 0.95

Calls 3

makeEventMethod · 0.95
ValidateEventTypeFunction · 0.92
ErrorfMethod · 0.65

Tested by

no test coverage detected