kube_runtime::watcher

Function watch_object

source
pub fn watch_object<K: Resource + Clone + DeserializeOwned + Debug + Send + 'static>(
    api: Api<K>,
    name: &str,
) -> impl Stream<Item = Result<Option<K>>> + Send
Expand description

Watch a single named object for updates

Emits None if the object is deleted (or not found), and Some if an object is updated (or created/found).

Often invoked indirectly via await_condition.

ยงScope Warning

When using this with an Api::all on namespaced resources there is a chance of duplicated names. To avoid getting confusing / wrong answers for this, use Api::namespaced bound to a specific namespace when watching for transitions to namespaced objects.