(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{})
| 42 | } |
| 43 | |
| 44 | func (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 | |
| 67 | func (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()} |
nothing calls this directly
no test coverage detected