mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-03 02:07:55 +00:00
Remove recorder.PastEventf
method
The `recorder.PastEventf` method wasn't actually working as advertised. It was supposed to accept a timestamp, which would be used when generating the event. However, as the [source code](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/tools/record/event.go#L316) shows, this `timestamp` was never actually used. In other words, `PastEventf` is identical to `Eventf`. We have two options: one would be to fix `PastEventf` so that it works as advertised. The other would be to delete `PastEventf` and only support `Eventf`. Ultimately, I could only find one use of `PastEventf` in the code base, so I propose we just delete `PastEventf` and convert all uses to `Eventf`. Kubernetes-commit: 92940fa80d67593c7a2333267da4424c8b45ac88
This commit is contained in:
parent
787fa2adce
commit
3ada5c0eb8
@ -102,9 +102,6 @@ type EventRecorder interface {
|
|||||||
// Eventf is just like Event, but with Sprintf for the message field.
|
// Eventf is just like Event, but with Sprintf for the message field.
|
||||||
Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{})
|
Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{})
|
||||||
|
|
||||||
// PastEventf is just like Eventf, but with an option to specify the event's 'timestamp' field.
|
|
||||||
PastEventf(object runtime.Object, timestamp metav1.Time, eventtype, reason, messageFmt string, args ...interface{})
|
|
||||||
|
|
||||||
// AnnotatedEventf is just like eventf, but with annotations attached
|
// AnnotatedEventf is just like eventf, but with annotations attached
|
||||||
AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{})
|
AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{})
|
||||||
}
|
}
|
||||||
@ -343,10 +340,6 @@ func (recorder *recorderImpl) Eventf(object runtime.Object, eventtype, reason, m
|
|||||||
recorder.Event(object, eventtype, reason, fmt.Sprintf(messageFmt, args...))
|
recorder.Event(object, eventtype, reason, fmt.Sprintf(messageFmt, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (recorder *recorderImpl) PastEventf(object runtime.Object, timestamp metav1.Time, eventtype, reason, messageFmt string, args ...interface{}) {
|
|
||||||
recorder.generateEvent(object, nil, timestamp, eventtype, reason, fmt.Sprintf(messageFmt, args...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (recorder *recorderImpl) AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{}) {
|
func (recorder *recorderImpl) AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{}) {
|
||||||
recorder.generateEvent(object, annotations, metav1.Now(), eventtype, reason, fmt.Sprintf(messageFmt, args...))
|
recorder.generateEvent(object, annotations, metav1.Now(), eventtype, reason, fmt.Sprintf(messageFmt, args...))
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ package record
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -42,9 +41,6 @@ func (f *FakeRecorder) Eventf(object runtime.Object, eventtype, reason, messageF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FakeRecorder) PastEventf(object runtime.Object, timestamp metav1.Time, eventtype, reason, messageFmt string, args ...interface{}) {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *FakeRecorder) AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{}) {
|
func (f *FakeRecorder) AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{}) {
|
||||||
f.Eventf(object, eventtype, reason, messageFmt, args)
|
f.Eventf(object, eventtype, reason, messageFmt, args)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user