From 7ff120a1cad8797b098919eada1485573ea722c5 Mon Sep 17 00:00:00 2001 From: Ivan Kiselev <10528835+ivan-kiselev@users.noreply.github.com> Date: Wed, 14 Aug 2024 12:33:28 +0200 Subject: [PATCH] Add finalizers predicate filter (#1560) Signed-off-by: Ivan Kiselev --- kube-runtime/src/utils/predicate.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kube-runtime/src/utils/predicate.rs b/kube-runtime/src/utils/predicate.rs index 893db0afb..3ed684a3c 100644 --- a/kube-runtime/src/utils/predicate.rs +++ b/kube-runtime/src/utils/predicate.rs @@ -11,7 +11,7 @@ use std::{ hash::{Hash, Hasher}, }; -fn hash(t: &T) -> u64 { +fn hash(t: &T) -> u64 { let mut hasher = DefaultHasher::new(); t.hash(&mut hasher); hasher.finish() @@ -191,6 +191,11 @@ pub mod predicates { pub fn annotations(obj: &K) -> Option { Some(hash(obj.annotations())) } + + /// Hash the finalizers of a Resource K + pub fn finalizers(obj: &K) -> Option { + Some(hash(obj.finalizers())) + } } #[cfg(test)]