From 9062eec965143efe4c79bca6e73ff4beb8eca3fe Mon Sep 17 00:00:00 2001 From: Andrew McDermott Date: Wed, 10 Sep 2025 21:49:46 +0100 Subject: [PATCH 1/2] Enable HTTP/2 features in hyper dependencies Add http2 feature to hyper, hyper-util, and hyper-rustls to enable HTTP/2 ALPN support in the kube-client. This complements the enable_http2() API call to provide full HTTP/2 multiplexing capability for Kubernetes API connections. Signed-off-by: Andrew McDermott --- kube-client/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kube-client/Cargo.toml b/kube-client/Cargo.toml index ae7cbb71a..b82886aec 100644 --- a/kube-client/Cargo.toml +++ b/kube-client/Cargo.toml @@ -63,9 +63,9 @@ tokio = { workspace = true, features = ["time", "signal", "sync"], optional = tr kube-core = { path = "../kube-core", version = "=2.0.0" } jsonpath-rust = { workspace = true, optional = true } tokio-util = { workspace = true, features = ["io", "codec"], optional = true } -hyper = { workspace = true, features = ["client", "http1"], optional = true } -hyper-util = { workspace = true, features = ["client", "client-legacy", "http1", "tokio", "tracing"], optional = true } -hyper-rustls = { workspace = true, features = ["http1", "logging", "native-tokio", "tls12"], optional = true } +hyper = { workspace = true, features = ["client", "http1", "http2"], optional = true } +hyper-util = { workspace = true, features = ["client", "client-legacy", "http1", "http2", "tokio", "tracing"], optional = true } +hyper-rustls = { workspace = true, features = ["http1", "http2", "logging", "native-tokio", "tls12"], optional = true } tokio-tungstenite = { workspace = true, optional = true } tower = { workspace = true, features = ["buffer", "filter", "util"], optional = true } tower-http = { workspace = true, features = ["auth", "map-response-body", "trace"], optional = true } From 0b5cdf23879e23ddc3b90557bf39b57136fc4be0 Mon Sep 17 00:00:00 2001 From: Andrew McDermott Date: Wed, 10 Sep 2025 21:49:09 +0100 Subject: [PATCH 2/2] Enable HTTP/2 support in kube-client rustls connector This change adds HTTP/2 ALPN support to the rustls HTTPS connector by calling enable_http2() in addition to enable_http1(). This enables HTTP/2 multiplexing for Kubernetes API connections, reducing the number of TCP connections from potentially hundreds to a single multiplexed connection per API server. Previously, kube-rs only supported HTTP/1.1 connections, resulting in a new TCP connection for each concurrent API request. With HTTP/2 enabled, multiple requests can be multiplexed over a single connection, improving performance and reducing resource usage. Signed-off-by: Andrew McDermott --- kube-client/src/client/config_ext.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kube-client/src/client/config_ext.rs b/kube-client/src/client/config_ext.rs index ccdb3f600..e81f7f2e8 100644 --- a/kube-client/src/client/config_ext.rs +++ b/kube-client/src/client/config_ext.rs @@ -245,7 +245,7 @@ impl ConfigExt for Config { .map_err(Error::RustlsTls)?, )); } - Ok(builder.enable_http1().wrap_connector(connector)) + Ok(builder.enable_http1().enable_http2().wrap_connector(connector)) } #[cfg(feature = "openssl-tls")]