Trait kube_runtime::wait::Condition[][src]

pub trait Condition<K> {
    fn matches_object(&self, obj: Option<&K>) -> bool;
}
Expand description

A trait for condition functions to be used by await_condition

Note that this is auto-implemented for functions of type fn(Option<&K>) -> bool.

Usage

use kube::runtime::wait::Condition;
use k8s_openapi::api::core::v1::Pod;
fn my_custom_condition(my_cond: &str) -> impl Condition<Pod> + '_ {
    move |obj: Option<&Pod>| {
        if let Some(pod) = &obj {
            if let Some(status) = &pod.status {
                if let Some(conds) = &status.conditions {
                    if let Some(pcond) = conds.iter().find(|c| c.type_ == my_cond) {
                        return pcond.status == "True";
                    }
                }
            }
        }
        false
    }
}

Required methods

Implementors