metrics-server API for kubernetes-client/c

Skip to first unread message

Ferenc Gerlits

Jul 20, 2022, 7:01:01 AMJul 20
to dev

We use kubernetes-client/c in our project and access the metrics-server API `apis/` using the low-level `apiClient_invoke()`, since there is no wrapper for this API in kubernetes-client/c.

I am thinking of contributing a new MetricsServerV1Beta1API wrapper for these API calls (GET pods, GET nodes).  Is that something you would be interested in, and could be accepted as a pull request?

Thank you,

Boshi Lian

Jul 20, 2022, 2:36:50 PMJul 20
to, dev

You received this message because you are subscribed to the Google Groups "dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Jordan Liggitt

Jul 20, 2022, 2:47:28 PMJul 20
to,, dev
I think the intent of the kubernetes-client generated clients is to include typed clients for APIs compiled into kube-apiserver, but not for aggregated APIs and CRD-based APIs.

For aggregated and CRD-based APIs, something like could be useful.

Kevin Wiesmueller

Jul 20, 2022, 2:55:21 PMJul 20
to,,, dev
I agree with Jordan, I don't think metrics api belongs in the client-go typed client and should rather be provided by metrics-server or whoever defines the metrics-api schema like other non-standard apis. Especially because it's not a default/optional api so having it in the client would formalize it more than it is right now.

Brendan Burns

Jul 20, 2022, 3:31:32 PMJul 20
to,,, fgerlits, dev
I'm the maintainer of many of these clients (including assisting w/ the C client)

Generating code for CRDs and other extension APIs is actually fairly straightforward to do, there is documentation here for how to do it in Java:

We have taken the approach that we will generate separate API packages based on community contributions.

I hope that you can adapt the Java instructions to generate C code instead, but if you run into problems please file issues on and we can discuss it there.

In addition, we also supply a 'generic' client which can work with any API (at the expense of having typed values in your code) but it may be easier to get started with:

Part of the reason why this is feasible is that all of the clients other than golang are based on code generation rather than hand-written code (though code generation brings it's own set of issues, it's a tradeoff)


From: 'Kevin Wiesmueller' via dev <>
Sent: Wednesday, July 20, 2022 11:55 AM
To: <>
Cc: <>; fgerlits <>; dev <>
Subject: [EXTERNAL] Re: metrics-server API for kubernetes-client/c

Hui Yu

Jul 20, 2022, 10:17:32 PMJul 20
to dev,,,, dev,,
I agree with Brendan and the other commenters here.

Now the best solution for aggregated APIs and CRD-based APIs using kubernetes-client/c is 'generic' client:
I will document this in the README to make it easier for developers to find this solution.

But I also wonder if we should keep/develop the codebase for the metrics server API `apis/` with a generic client somewhere to avoid duplication of work by other developers? Because more than one developer mentioned before that they implemented the metrics API client using kubernetes-client/c.

Ferenc Gerlits

Jul 21, 2022, 9:17:55 AMJul 21
to dev,,,,, Hui Yu
Thanks everyone for your help!  I did not know about genericClient.  I will use that, as it is nice and simple.  And thanks Hui for adding it to the README, I think that will be useful to others, as well.
Reply all
Reply to author
0 new messages