-
Hi, I have the same question as here but didn't want to resurrect such an old thread. tl;dr I have a cluster with Istio installed and want to create / manipulate some of its types. (A lot of the examples deal with programmatically deploying new CRDs but I've never seen CRDs managed like that in a real cluster, plus it's not my type). I've written some code based on the Likewise to make a new one, am I going to need to construct a instance of nested Objects and Arrays - feels really clunky. I guess two questions:
let crds: Api<CustomResourceDefinition> = Api::all(client.clone());
let crd = crds.get("DestinationRule").await?;
let crdType = magic(crd);
let drs: Api<crdType> = ... I realise rust isn't a dynamic language like this, but maybe using index overriding for an API like let crdType = magic(crd);
let dr = new_dynamic(crdType, o!(subsets = a!("foo", "bar")));
dr["spec"]["subsets"][0] = ... Or is my best bet just forking k8s_openapi and re-running its auto-generation on the istio schema too? (Seems like a maintenance nightmare, especially when, by definition, the types will be specified in any cluster I interact with) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I defer to the maintainers on perceived stability/readiness but you may be able to get a head start using https://github.com/kube-rs/kopium |
Beta Was this translation helpful? Give feedback.
-
As it so happens, there is now some high level docs on the different types of typing that we currently support over at https://kube.rs/controllers/object/ from a controller writer POV. Please let me know what you think. As mentioned above, There isn't currently any concrete plans for anything more advanced (kopium is evolving at a steady pace), but we are open to good ideas! |
Beta Was this translation helpful? Give feedback.
As it so happens, there is now some high level docs on the different types of typing that we currently support over at https://kube.rs/controllers/object/ from a controller writer POV. Please let me know what you think.
As mentioned above,
kopium
is indeed the closest thing to this type ofmagic
you describe, but it does not* support generation at run-time, so you're effectively pre-generating the code for all the crds that you wish to support in your app.There isn't currently any concrete plans for anything more advanced (kopium is evolving at a steady pace), but we are open to good ideas!
you can shoehorn
kopium
into a CI build step, but it's currently a bit awkward in that it would re…