Skip to content

Commit

Permalink
Upgrades Tower to 0.5.1
Browse files Browse the repository at this point in the history
fixes kube-rs#1569

Signed-off-by: Mark Ingram <mark@lincs.dev>
  • Loading branch information
markdingram committed Sep 24, 2024
1 parent acd2d8e commit f884bc6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ http = "1.1.0"
http-body = "1.0.0"
http-body-util = "0.1.2"
hyper = "1.2.0"
hyper-util = "0.1.3"
hyper-util = "0.1.9"
hyper-openssl = "0.10.2"
hyper-rustls = { version = "0.27.1", default-features = false }
hyper-socks2 = { version = "0.9.0", default-features = false }
Expand Down Expand Up @@ -84,8 +84,8 @@ tokio = "1.14.0"
tokio-test = "0.4.0"
tokio-tungstenite = "0.24.0"
tokio-util = "0.7.0"
tower = "0.4.13"
tower-http = "0.5.2"
tower = "0.5.1"
tower-http = "0.6.1"
tower-test = "0.4.0"
tracing = "0.1.36"
tracing-subscriber = "0.3.17"
Expand Down
1 change: 1 addition & 0 deletions kube-client/src/client/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ where
}
}),
)
.map_err(BoxError::from)
.service(client);

Ok(ClientBuilder::new(
Expand Down
6 changes: 3 additions & 3 deletions kube-client/src/client/config_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@ impl ConfigExt for Config {
fn auth_layer(&self) -> Result<Option<AuthLayer>> {
Ok(match Auth::try_from(&self.auth_info).map_err(Error::Auth)? {
Auth::None => None,
Auth::Basic(user, pass) => Some(AuthLayer(Either::A(
Auth::Basic(user, pass) => Some(AuthLayer(Either::Left(
AddAuthorizationLayer::basic(&user, pass.expose_secret()).as_sensitive(true),
))),
Auth::Bearer(token) => Some(AuthLayer(Either::A(
Auth::Bearer(token) => Some(AuthLayer(Either::Left(
AddAuthorizationLayer::bearer(token.expose_secret()).as_sensitive(true),
))),
Auth::RefreshableToken(refreshable) => {
Some(AuthLayer(Either::B(AsyncFilterLayer::new(refreshable))))
Some(AuthLayer(Either::Right(AsyncFilterLayer::new(refreshable))))
}
Auth::Certificate(_client_certificate_data, _client_key_data) => None,
})
Expand Down
21 changes: 13 additions & 8 deletions kube-client/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
//! The [`Client`] can also be used with [`Discovery`](crate::Discovery) to dynamically
//! retrieve the resources served by the kubernetes API.
use either::{Either, Left, Right};
use futures::{AsyncBufRead, StreamExt, TryStream, TryStreamExt};
use futures::{future::BoxFuture, AsyncBufRead, StreamExt, TryStream, TryStreamExt};
use http::{self, Request, Response};
use http_body_util::BodyExt;
#[cfg(feature = "ws")] use hyper_util::rt::TokioIo;
#[cfg(feature = "ws")]
use hyper_util::rt::TokioIo;
use k8s_openapi::apimachinery::pkg::apis::meta::v1 as k8s_meta_v1;
pub use kube_core::response::Status;
use serde::de::DeserializeOwned;
Expand Down Expand Up @@ -42,12 +43,15 @@ pub use auth::Error as AuthError;
pub use config_ext::ConfigExt;
pub mod middleware;

#[cfg(any(feature = "rustls-tls", feature = "openssl-tls"))] mod tls;
#[cfg(any(feature = "rustls-tls", feature = "openssl-tls"))]
mod tls;

#[cfg(feature = "openssl-tls")]
pub use tls::openssl_tls::Error as OpensslTlsError;
#[cfg(feature = "rustls-tls")] pub use tls::rustls_tls::Error as RustlsTlsError;
#[cfg(feature = "ws")] mod upgrade;
#[cfg(feature = "rustls-tls")]
pub use tls::rustls_tls::Error as RustlsTlsError;
#[cfg(feature = "ws")]
mod upgrade;

#[cfg(feature = "oauth")]
#[cfg_attr(docsrs, doc(cfg(feature = "oauth")))]
Expand All @@ -57,7 +61,8 @@ pub use auth::OAuthError;
#[cfg_attr(docsrs, doc(cfg(feature = "oidc")))]
pub use auth::oidc_errors;

#[cfg(feature = "ws")] pub use upgrade::UpgradeConnectionError;
#[cfg(feature = "ws")]
pub use upgrade::UpgradeConnectionError;

#[cfg(feature = "kubelet-debug")]
#[cfg_attr(docsrs, doc(cfg(feature = "kubelet-debug")))]
Expand All @@ -75,8 +80,8 @@ pub use builder::{ClientBuilder, DynBody};
#[derive(Clone)]
pub struct Client {
// - `Buffer` for cheap clone
// - `BoxService` for dynamic response future type
inner: Buffer<BoxService<Request<Body>, Response<Body>, BoxError>, Request<Body>>,
// - `BoxFuture` for dynamic response future type
inner: Buffer<Request<Body>, BoxFuture<'static, Result<Response<Body>, BoxError>>>,
default_ns: String,
}

Expand Down

0 comments on commit f884bc6

Please sign in to comment.