From 62f95cd9a8506b639e01e10af417fecb7b45e292 Mon Sep 17 00:00:00 2001 From: Eirik A Date: Wed, 9 Oct 2024 10:25:07 +0100 Subject: [PATCH] Stabilise runtime predicates (#1578) * Stabilise runtime predicates These are unlikely to undergo much changes (and if they do they are completely separated). This should be an easy feature cleanup in runtime, and one less need for unstable-runtime for common setups (i use this all the time). Signed-off-by: clux * clippy Signed-off-by: clux * remove stray reference to unstable in docs for the entrypoint Signed-off-by: clux --------- Signed-off-by: clux Signed-off-by: Eirik A --- kube-runtime/Cargo.toml | 3 +-- kube-runtime/src/lib.rs | 1 - kube-runtime/src/utils/mod.rs | 3 +-- kube-runtime/src/utils/watch_ext.rs | 13 ++++++------- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/kube-runtime/Cargo.toml b/kube-runtime/Cargo.toml index 4e343341f..44c37cf9e 100644 --- a/kube-runtime/Cargo.toml +++ b/kube-runtime/Cargo.toml @@ -12,9 +12,8 @@ keywords = ["kubernetes", "runtime", "reflector", "watcher", "controller"] categories = ["web-programming::http-client", "caching", "network-programming"] [features] -unstable-runtime = ["unstable-runtime-subscribe", "unstable-runtime-predicates", "unstable-runtime-stream-control", "unstable-runtime-reconcile-on"] +unstable-runtime = ["unstable-runtime-subscribe", "unstable-runtime-stream-control", "unstable-runtime-reconcile-on"] unstable-runtime-subscribe = [] -unstable-runtime-predicates = [] unstable-runtime-stream-control = [] unstable-runtime-reconcile-on = [] diff --git a/kube-runtime/src/lib.rs b/kube-runtime/src/lib.rs index 50a0b961d..7d0d8512c 100644 --- a/kube-runtime/src/lib.rs +++ b/kube-runtime/src/lib.rs @@ -37,6 +37,5 @@ pub use scheduler::scheduler; pub use utils::WatchStreamExt; pub use watcher::{metadata_watcher, watcher}; -#[cfg(feature = "unstable-runtime-predicates")] pub use utils::{predicates, Predicate}; pub use wait::conditions; diff --git a/kube-runtime/src/utils/mod.rs b/kube-runtime/src/utils/mod.rs index b8fd342b7..74cc7cf2f 100644 --- a/kube-runtime/src/utils/mod.rs +++ b/kube-runtime/src/utils/mod.rs @@ -4,7 +4,7 @@ mod backoff_reset_timer; pub(crate) mod delayed_init; mod event_decode; mod event_modify; -#[cfg(feature = "unstable-runtime-predicates")] mod predicate; +mod predicate; mod reflect; mod stream_backoff; mod watch_ext; @@ -12,7 +12,6 @@ mod watch_ext; pub use backoff_reset_timer::ResetTimerBackoff; pub use event_decode::EventDecode; pub use event_modify::EventModify; -#[cfg(feature = "unstable-runtime-predicates")] pub use predicate::{predicates, Predicate, PredicateFilter}; pub use reflect::Reflect; pub use stream_backoff::StreamBackoff; diff --git a/kube-runtime/src/utils/watch_ext.rs b/kube-runtime/src/utils/watch_ext.rs index 94e4cbe16..67ebf0d0a 100644 --- a/kube-runtime/src/utils/watch_ext.rs +++ b/kube-runtime/src/utils/watch_ext.rs @@ -1,7 +1,10 @@ -#[cfg(feature = "unstable-runtime-predicates")] -use crate::utils::predicate::{Predicate, PredicateFilter}; use crate::{ - utils::{event_decode::EventDecode, event_modify::EventModify, stream_backoff::StreamBackoff}, + utils::{ + event_decode::EventDecode, + event_modify::EventModify, + predicate::{Predicate, PredicateFilter}, + stream_backoff::StreamBackoff, + }, watcher, }; use kube_client::Resource; @@ -94,8 +97,6 @@ pub trait WatchStreamExt: Stream { /// Common use case for this is to avoid repeat events for status updates /// by filtering on [`predicates::generation`](crate::predicates::generation). /// - /// **NB**: This is constructor requires an [`unstable`](https://github.com/kube-rs/kube/blob/main/kube-runtime/Cargo.toml#L17-L21) feature. - /// /// ## Usage /// ```no_run /// # use std::pin::pin; @@ -116,7 +117,6 @@ pub trait WatchStreamExt: Stream { /// # Ok(()) /// # } /// ``` - #[cfg(feature = "unstable-runtime-predicates")] fn predicate_filter(self, predicate: P) -> PredicateFilter where Self: Stream> + Sized, @@ -272,7 +272,6 @@ pub trait WatchStreamExt: Stream { impl WatchStreamExt for St where St: Stream {} // Compile tests -#[cfg(feature = "unstable-runtime-predicates")] #[cfg(test)] pub(crate) mod tests { use super::watcher;