-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeMeta is empty on .List() resources #1328
Comments
Does the API server return the type meta for list entries? |
Yes. It is returned, but reset by client-go. After fetching from the server all information is present, but the |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
Previous code used `GroupVersionKind` method on actual resources to determine group/kind strings for them, but client-go unfortunately drops `TypeMeta` on resources processed by typed client (kubernetes/client-go#1328, kubernetes/client-go#541). Fortunately we know what types we build insights for, so we can use appropriate strings from client code for groups and hardcode kinds ourselves.
Previous code used `GroupVersionKind` method on actual resources to determine group/kind strings for them, but client-go unfortunately drops `TypeMeta` on resources processed by typed client (kubernetes/client-go#1328, kubernetes/client-go#541). Fortunately we know what types we build insights for, so we can use appropriate strings from client code for groups and hardcode kinds ourselves.
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
/remove-lifecycle rotten |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
/lifecycle frozen Should this issue be in k/k repo? |
I think this is a duplicate of kubernetes/kubernetes#3030 and kubernetes/kubernetes#80609 |
closing as a duplicate, see the two existing k/k issues (one tracking how now all server responses include apiVersion / kind data on individual items in lists, the other tracking how the client decoding methods clear those fields when they are populated in the server as part of decoding into typed go structs) |
This is basically a reopen from #541 because I did not see why @shsjshentao closed this in the first place.
After listing / getting resources with client-go (tested with Deployments, StatefulSets and DaemonSets),
obj.TypeMeta
is empty. The fieldsKind
andApiVersion
are empty strings.After the REST call and JSON deserialisation the data is still available, but is is explicitly cleared:
https://github.com/kubernetes/apimachinery/blob/02a41040d88da08de6765573ae2b1a51f424e1ca/pkg/runtime/helper.go#L255C8-L263
Is there any specific reason while this is necessary? This is valuable information that I need later to set
OwnerReferences
and for logging. I tried with git blame to check for the commit / PR this was introduced, but there was no information.The text was updated successfully, but these errors were encountered: