-
I'm trying to iterate over the CRD's in a cluster and while doing that, I'd want to find all of the resources in the cluster of that type. I looked over the examples, and specifically crd_derive_no_schema but I wasn't able to connect the dots since I don't know the CRD type(s) before hand. let config = Config::infer().await?
let client: Client = Client::try_from(config.clone())?;
let crds: Api<CustomResourceDefinition> = Api::all(client.clone());
for crd in &crds {
let kind : String = ...
// I'd like to find all of the resources of `kind`.
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
if you want to iterate over multiple crds in an api group (or just a single kind), but don't have the type at hand that implements see https://github.com/kube-rs/kube/blob/main/examples/dynamic_api.rs and other |
Beta Was this translation helpful? Give feedback.
-
Awesome, thank you sir! That was exactly what I was looking for. |
Beta Was this translation helpful? Give feedback.
if you want to iterate over multiple crds in an api group (or just a single kind), but don't have the type at hand that implements
Resource
, then you need to use dynamic type with discovery to get the type information.see https://github.com/kube-rs/kube/blob/main/examples/dynamic_api.rs and other
dynamic_
examples.possibly you want a pinned_kind oneshot discovery?