diff --git a/examples/dynamic_watcher.rs b/examples/dynamic_watcher.rs index ad5c42c3f..a903e8dd5 100644 --- a/examples/dynamic_watcher.rs +++ b/examples/dynamic_watcher.rs @@ -19,7 +19,17 @@ async fn main() -> anyhow::Result<()> { // Turn them into a GVK let gvk = GroupVersionKind::gvk(&group, &version, &kind); - let api_resource = ApiResource::from_gvk(&gvk); + let mut api_resource = ApiResource::from_gvk(&gvk); + + if let Some(resource) = env::var("RESOURCE").ok() { + api_resource.plural = resource; + } else { + println!( + "Using inferred plural name (use RESOURCE to override): {}", + api_resource.plural + ); + } + // Use them in an Api with the GVK as its DynamicType let api = Api::::all_with(client, &api_resource);