I'm trying to watch kubernetes events (events.k8s.io) using golang script, and all events have field eventTime
filled with null
. What is the full explanation of it?
Diving deeper while trying to find it out, I've found only this statement in KEP about graduating this API:
There will be conversion functions that'll allow reading/writing Events as both core.Event and events.Event types. As we don't want to officially extend core.Event type, new fields will be set only if Event would be written through events.Event endpoint (e.g. if Event will be created by core.Event endpoint EventTime won't be set).
So will this ever change? If yes, then when? I've run the script in kube versions 1.21-1.25, and in all cases event time was null. I expect to see event time to be not null. Thank You for Your time, guys!
Upd. I've found code in kubernetes with conversion of core.Event
to events.Event
, and there is mapping of eventTime. So now I should check if event time is filled in core/v1 events.
There will be conversion functions that'll allow reading/writing Events as both core.Event and events.Event types. As we don't want to officially extend core.Event type, new fields will be set only if Event would be written through events.Event endpoint (e.g. if Event will be created by core.Event endpoint EventTime won't be set).
eventTime: null
. Specifically, events from the kube-scheduler come with a correct eventTime but with deprecated.*
fields (such as deprecatedCount, deprecatedFirstTimestamp, etc.) empty. There are just not many of them.k8s.io/client-go/tools/events
(https://github.com/kubernetes/client-go/tree/master/tools/events) and k8s.io/client-go/tools/record
(https://github.com/kubernetes/client-go/tree/master/tools/record). The first is responsible for sending events of type events.k8s.io.Event, which we read, and the second for sending corev1.Event events.