dd-trace-go icon indicating copy to clipboard operation
dd-trace-go copied to clipboard

contrib/k8s.io/client-go/kubernetes: Resource names are not set properly

Open pbzweihander opened this issue 3 years ago • 2 comments

Kubernetes wrapper uses RequestToResource function to generate resource name. And RequestToResource function assumes URL path starts with /api/v1. This assumption seems to be incorrect. Reference: https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-uris

pbzweihander avatar Sep 27 '22 08:09 pbzweihander

Good catch, it seems like for the most popular endpoints this approach works but I do see for example the events endpoints don't match this formatting and will end up with a resource name that is just the HTTP Method. e.g. /apis/events.k8s.io/v1/namespaces/default/events. Do you have your own code example that isn't working alongside the resource name that you are expecting? I've created a bug ticket for us internally to track this as well.

ajgajg1134 avatar Sep 28 '22 20:09 ajgajg1134

According to the Kubernetes reference (https://kubernetes.io/docs/reference/using-api/#api-groups), only the core group APIs start with /api/v1/, and the named group APIs start with /apis/{group}/{version}/. So every Kubernetes API except the core group will not work.

pbzweihander avatar Sep 29 '22 03:09 pbzweihander