Skip to content

Commit

Permalink
Add finalizers predicate filter (#1560)
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Kiselev <[email protected]>
  • Loading branch information
ivan-kiselev authored Aug 14, 2024
1 parent e2ceea8 commit 7ff120a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kube-runtime/src/utils/predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::{
hash::{Hash, Hasher},
};

fn hash<T: Hash>(t: &T) -> u64 {
fn hash<T: Hash + ?Sized>(t: &T) -> u64 {
let mut hasher = DefaultHasher::new();
t.hash(&mut hasher);
hasher.finish()
Expand Down Expand Up @@ -191,6 +191,11 @@ pub mod predicates {
pub fn annotations<K: Resource>(obj: &K) -> Option<u64> {
Some(hash(obj.annotations()))
}

/// Hash the finalizers of a Resource K
pub fn finalizers<K: Resource>(obj: &K) -> Option<u64> {
Some(hash(obj.finalizers()))
}
}

#[cfg(test)]
Expand Down

0 comments on commit 7ff120a

Please sign in to comment.