Function kube_runtime::wait::await_condition [−][src]
pub async fn await_condition<K>(
api: Api<K>,
name: &str,
cond: impl FnMut(Option<&K>) -> bool
) -> Result<(), Error> where
K: Clone + Debug + Send + DeserializeOwned + Resource + 'static,
Expand description
Watch an object, and Wait for some condition cond
to return true
.
cond
is passed Some
if the object is found, otherwise None
.
Caveats
Keep in mind that the condition is typically fulfilled by an external service, which might not even be available. await_condition
does not automatically add a timeout. If this is desired, wrap it in tokio::time::timeout
.
Errors
Fails if the type is not known to the Kubernetes API, or if the Api
does not have
permission to watch
and list
it.
Does not fail if the object is not found.