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§