kube_core::labels

Trait SelectorExt

source
pub trait SelectorExt: Sealed {
    type Search;

    // Required method
    fn matches(&self, on: &Self::Search) -> bool;
}
Expand description

Selector extension trait for querying selector-like objects

Required Associated Types§

source

type Search

Collection type to compare with self

Required Methods§

source

fn matches(&self, on: &Self::Search) -> bool

Perform a match check on the arbitrary components like labels

use k8s_openapi::apimachinery::pkg::apis::meta::v1::LabelSelector;
use kube::core::{SelectorExt, Selector};

let selector: Selector = LabelSelector::default().try_into()?;
let search = BTreeMap::from([("app".to_string(), "myapp".to_string())]);
selector.matches(&search);

Implementors§