Closed TylerHelmuth closed 11 months ago
you are retrieving events in events.k8s.io/v1
version (corresponding to https://github.com/kubernetes/api/blob/86e8180c2c5fc26b0903248e2ec19bd30ee203bc/events/v1/types.go#L33) but then trying to coerce into v1
version objects (corresponding to https://github.com/kubernetes/api/blob/86e8180c2c5fc26b0903248e2ec19bd30ee203bc/core/v1/types.go#L6179)
You are correct the field names differ. For this to work properly, use the go types corresponding to the API group/version you are fetching (https://github.com/kubernetes/api/blob/86e8180c2c5fc26b0903248e2ec19bd30ee203bc/events/v1/types.go#L33).
@liggitt thank for the explanation. Which version of the event should be preferred, v1
or events.k8s.io/v1
?
I have a situation where a dynamic client is retrieving events in the cluster. The received events look like
This representation of the event uses
regarding
instead ofinvolvedObject
.I try to convert these objects to corev1.Events:
and I am left with an event without an involvedObject:
I believe the issue is that the event returned by the dynamic client has
regarding
instead ofinvolvedObject
like thecorev1.Event
struct expects.Please let me know if this is actually an issue for the
unstructured
package.