kube icon indicating copy to clipboard operation
kube copied to clipboard

client: Metadata-only API

Open olix0r opened this issue 3 years ago • 1 comments

client-go supports operations that only interact with resource metadata via the PartialObjectMetadata type. This can allow controllers to substantially reduce I/O and memory requirements when they don't actually need an object's spec or status.

We should extend the Api type with something like:

  • async fn get_metadata(name: &str) -> Result<ObjectMeta>
  • async fn list_metadata(lp: &ListParams) -> Result<ObjectList<ObjectMeta>>
  • async fn patch_metadata(name: &str, pp: &PatchParams, patch: &Patch<P>) -> Result<ObjectMeta>
  • async fn watch_metadata(lp: &ListParams, version: &str) -> Result<impl Stream<Item = Result<WatchEvent<ObjectMeta>>>>

These signatures may not be 100% correct--please update as needed to reflect the actual API semantics.

Discussed in https://github.com/kube-rs/kube/discussions/1023

olix0r avatar Sep 25 '22 19:09 olix0r

That seems nice, but hot damn I wish this was documented somewhere.

nightkr avatar Sep 27 '22 15:09 nightkr

Hey folks :) Has anyone started working on this? I'd like to take it up. I can at the very least start looking a little bit into the requirements, report back here, and get the ball rolling on a conversation around the changes necessary. Lmk :)

mateiidavid avatar Nov 19 '22 16:11 mateiidavid

Hey @mateiidavid ! We have not started looking at this yet, so if you have time to look at getting the base functionality of this working, then that would indeed be very helpful!

I expect this can follow the same flow as the rest of the request flow initially:

  • base Request impls in (probably) kube-core/src/request.rs (with some special care to handle the extended accept header)
  • Api impls in kube-client/src/api (maybe core_methods file)

and have some kind of base integration tests for some type for at least get/list/patch, and some Request level unit tests in kube-core. But I have not dug too deep into this.

clux avatar Nov 20 '22 09:11 clux

Thanks @clux, that's a lot to get me going. Will try to give periodic updates :)

mateiidavid avatar Nov 22 '22 10:11 mateiidavid