Skip to content
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

Utilize HasSpec and HasObject traits for api methods #295

Open
clux opened this issue Jul 26, 2020 · 3 comments
Open

Utilize HasSpec and HasObject traits for api methods #295

clux opened this issue Jul 26, 2020 · 3 comments
Labels
api Api abstraction related blocked awaiting upstream work

Comments

@clux
Copy link
Member

clux commented Jul 26, 2020

From a scan of k8s-openapi it does appear that it's only the Object<P, U> types, i.e. objects that look like:

  • typemeta (kind + apiVersion)
  • metadata
  • spec
  • status

That actually support the status subresource methods.

If we had a trait for "implements the spec and status model", then we might be able to implement it more accurately in subresource.rs and actually constrain the type definition for what goes in and comes out of the api methods there.

    pub async fn replace_status(&self, name: &str, pp: &PostParams, data: Vec<u8>) -> Result<K> {
        let req = self.resource.replace_status(name, &pp, data)?;
        self.client.request::<K>(req).await
    }

currently they are awkwardly all handling bytes as input.
..but then again, people will want to use server side apply on pretty much everything here anyway, so maybe it's not worth it.

@clux clux added question Direction unclear; possibly a bug, possibly could be improved. api Api abstraction related labels Jul 26, 2020
@clux
Copy link
Member Author

clux commented Jul 26, 2020

A trait similar to this this would also be useful for the scale subresource, allowing us to could help close #142. Though I suspect either of these would have to be defined on the k8s-openapi side (and implemented there for structs that allow it).

@clux
Copy link
Member Author

clux commented Jul 27, 2020

Another annoying point; subresources may need two versions by the look of the APIResource struct

@clux
Copy link
Member Author

clux commented Nov 3, 2021

We have had traits for this for a while; HasSpec and HasStatus (convenience for Object), but we are actually filling these out in k8s-pb: kube-rs/k8s-pb#4 so this can be solved after the protobuf issue #371

@clux clux added blocked awaiting upstream work and removed question Direction unclear; possibly a bug, possibly could be improved. labels Nov 3, 2021
@clux clux changed the title Define a trait for objects following spec/status model? Define a trait for objects following spec/status model Nov 3, 2021
@clux clux changed the title Define a trait for objects following spec/status model Utilize HasSpec and HasObject traits for api methods Nov 3, 2021
@clux clux added this to Kube Roadmap Nov 3, 2021
@clux clux moved this to Defining in Kube Roadmap Nov 3, 2021
@clux clux moved this from Defining to Blocked in Kube Roadmap Nov 3, 2021
@clux clux moved this from Blocked to Backlog in Kube Roadmap Nov 3, 2021
@clux clux moved this from Backlog to Defining in Kube Roadmap Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Api abstraction related blocked awaiting upstream work
Projects
Status: Defining
Development

No branches or pull requests

1 participant