Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add finalizers predicate filter #1560

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 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()))

Check warning on line 197 in kube-runtime/src/utils/predicate.rs

View check run for this annotation

Codecov / codecov/patch

kube-runtime/src/utils/predicate.rs#L196-L197

Added lines #L196 - L197 were not covered by tests
}
}

#[cfg(test)]
Expand Down
Loading