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

Method Eventf

tools/events/event_recorder.go:44–65  ·  view source on GitHub ↗
(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{})

Source from the content-addressed store, hash-verified

42}
43
44func (recorder *recorderImpl) Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{}) {
45 timestamp := metav1.MicroTime{time.Now()}
46 message := fmt.Sprintf(note, args...)
47 refRegarding, err := reference.GetReference(recorder.scheme, regarding)
48 if err != nil {
49 klog.Errorf("Could not construct reference to: '%#v' due to: '%v'. Will not report event: '%v' '%v' '%v'", regarding, err, eventtype, reason, message)
50 return
51 }
52 refRelated, err := reference.GetReference(recorder.scheme, related)
53 if err != nil {
54 klog.Errorf("Could not construct reference to: '%#v' due to: '%v'.", related, err)
55 }
56 if !util.ValidateEventType(eventtype) {
57 klog.Errorf("Unsupported event type: '%v'", eventtype)
58 return
59 }
60 event := recorder.makeEvent(refRegarding, refRelated, timestamp, eventtype, reason, message, recorder.reportingController, recorder.reportingInstance, action)
61 go func() {
62 defer utilruntime.HandleCrash()
63 recorder.Action(watch.Added, event)
64 }()
65}
66
67func (recorder *recorderImpl) makeEvent(refRegarding *v1.ObjectReference, refRelated *v1.ObjectReference, timestamp metav1.MicroTime, eventtype, reason, message string, reportingController string, reportingInstance string, action string) *v1beta1.Event {
68 t := metav1.Time{Time: recorder.clock.Now()}

Callers

nothing calls this directly

Calls 5

makeEventMethod · 0.95
GetReferenceFunction · 0.92
ValidateEventTypeFunction · 0.92
NowMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected