diff --git a/Cargo.toml b/Cargo.toml index f93c3463b..7f95f369c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] default-members = ["kube"] +resolver = "2" members = [ "kube", "kube-client", diff --git a/kube-client/src/client/tls.rs b/kube-client/src/client/tls.rs index 3c84477f9..45785a8c9 100644 --- a/kube-client/src/client/tls.rs +++ b/kube-client/src/client/tls.rs @@ -53,7 +53,7 @@ pub mod rustls_tls { let mut client_config = if let Some((chain, pkey)) = identity_pem.map(client_auth).transpose()? { config_builder - .with_single_cert(chain, pkey) + .with_client_auth_cert(chain, pkey) .map_err(Error::InvalidPrivateKey)? } else { config_builder.with_no_client_auth() diff --git a/kube-core/src/params.rs b/kube-core/src/params.rs index dca11816d..ae81642c8 100644 --- a/kube-core/src/params.rs +++ b/kube-core/src/params.rs @@ -327,9 +327,6 @@ pub struct WatchParams { /// when request started being processed. /// - `resourceVersionMatch` set to any other value or unset /// Invalid error is returned. - /// - /// Defaults to true if `resourceVersion=""` or `resourceVersion="0"` (for backward - /// compatibility reasons) and to false otherwise. pub send_initial_events: bool, } @@ -341,12 +338,10 @@ impl WatchParams { return Err(Error::Validation("WatchParams::timeout must be < 295s".into())); } } - if self.send_initial_events { - if !self.bookmarks { - return Err(Error::Validation( - "WatchParams::bookmarks must be set when using send_initial_events".into(), - )); - } + if self.send_initial_events && !self.bookmarks { + return Err(Error::Validation( + "WatchParams::bookmarks must be set when using send_initial_events".into(), + )); } Ok(()) } diff --git a/kube-runtime/src/watcher.rs b/kube-runtime/src/watcher.rs index 3c946bcf7..193825258 100644 --- a/kube-runtime/src/watcher.rs +++ b/kube-runtime/src/watcher.rs @@ -201,7 +201,7 @@ pub enum ListSemantic { /// Configurable watcher listwatch semantics #[derive(Clone, Default, Debug, PartialEq)] -pub enum WatcherMode { +pub enum InitialListStrategy { #[default] ListWatch, /// Kubernetes 1.27 Streaming Lists @@ -232,6 +232,8 @@ pub struct Config { /// Semantics for list calls. /// /// Configures re-list for performance vs. consistency. + /// + /// NB: This option only has an effect for [`WatcherMode::ListWatch`]. pub list_semantic: ListSemantic, /// Kubernetes 1.27 Streaming Lists @@ -247,7 +249,7 @@ pub struct Config { /// /// See https://kubernetes.io/docs/reference/using-api/api-concepts/#streaming-lists /// See https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/3157-watch-list#design-details - pub watcher_mode: WatcherMode, + pub initial_list_strategy: InitialListStrategy, /// Maximum number of objects retrieved per list operation resyncs. /// @@ -255,6 +257,8 @@ pub struct Config { /// API roundtrips to complete. /// /// Defaults to 500. Note that `None` represents unbounded. + /// + /// NB: This option only has an effect for [`WatcherMode::ListWatch`]. pub page_size: Option, /// Enables watch events with type "BOOKMARK". @@ -275,7 +279,7 @@ impl Default for Config { // same default page size limit as client-go // https://github.com/kubernetes/client-go/blob/aed71fa5cf054e1c196d67b2e21f66fd967b8ab1/tools/pager/pager.go#L31 page_size: Some(500), - watcher_mode: WatcherMode::ListWatch, + initial_list_strategy: InitialListStrategy::ListWatch, } } } @@ -322,6 +326,8 @@ impl Config { } /// Sets list semantic to configure re-list performance and consistency + /// + /// NB: This option only has an effect for [`WatcherMode::ListWatch`]. #[must_use] pub fn list_semantic(mut self, semantic: ListSemantic) -> Self { self.list_semantic = semantic; @@ -329,6 +335,8 @@ impl Config { } /// Sets list semantic to `Any` to improve list performance + /// + /// NB: This option only has an effect for [`WatcherMode::ListWatch`]. #[must_use] pub fn any_semantic(self) -> Self { self.list_semantic(ListSemantic::Any) @@ -348,6 +356,8 @@ impl Config { /// /// This can reduce the memory consumption during resyncs, at the cost of requiring more /// API roundtrips to complete. + /// + /// NB: This option only has an effect for [`WatcherMode::ListWatch`]. #[must_use] pub fn page_size(mut self, page_size: u32) -> Self { self.page_size = Some(page_size); @@ -358,7 +368,7 @@ impl Config { /// Sets list semantic to `Stream` to make use of watch bookmarks #[must_use] pub fn streaming_lists(mut self) -> Self { - self.watcher_mode = WatcherMode::StreamingList; + self.initial_list_strategy = InitialListStrategy::StreamingList; self } @@ -387,7 +397,7 @@ impl Config { field_selector: self.field_selector.clone(), timeout: self.timeout, bookmarks: self.bookmarks, - send_initial_events: self.watcher_mode == WatcherMode::StreamingList, + send_initial_events: self.initial_list_strategy == InitialListStrategy::StreamingList, } } } @@ -456,8 +466,8 @@ where State::Empty { continue_token, mut objects, - } => match wc.watcher_mode { - WatcherMode::ListWatch => { + } => match wc.initial_list_strategy { + InitialListStrategy::ListWatch => { let mut lp = wc.to_list_params(); lp.continue_token = continue_token; match api.list(&lp).await { @@ -492,7 +502,7 @@ where } } } - WatcherMode::StreamingList => match api.watch(&wc.to_watch_params(), "0").await { + InitialListStrategy::StreamingList => match api.watch(&wc.to_watch_params(), "0").await { Ok(stream) => (None, State::IntialWatch { stream, objects }), Err(err) => { if std::matches!(err, ClientErr::Api(ErrorResponse { code: 403, .. })) {