Skip to content

Commit

Permalink
Update dynamic watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
MikailBag committed Apr 19, 2021
1 parent 61fa936 commit 289ea1d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion examples/dynamic_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<DynamicObject>::all_with(client, &api_resource);

Expand Down

0 comments on commit 289ea1d

Please sign in to comment.