Skip to content

Commit bba11ca

Browse files
committed
deps: enable hyper-rustls/ring conditionally
no reason to include the "ring" crate if aws-lc-rs is being used. add a new "ring" feature (enabled by default, to avoid breaking existing users), that will enable hyper-rustls/ring only if needed. Signed-off-by: Eliad Peller <[email protected]>
1 parent ab488ae commit bba11ca

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

e2e/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ path = "boot.rs"
2020
[features]
2121
latest = ["k8s-openapi/latest"]
2222
mk8sv = ["k8s-openapi/earliest"]
23-
rustls = ["kube/rustls-tls"]
23+
rustls = ["kube/rustls-tls", "kube/ring"]
2424
openssl = ["kube/openssl-tls"]
2525

2626
[dependencies]

examples/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ release = false
1313
default = ["rustls-tls", "kubederive", "ws", "latest", "socks5", "runtime", "refresh"]
1414
kubederive = ["kube/derive"]
1515
openssl-tls = ["kube/client", "kube/openssl-tls", "kube/unstable-client"]
16-
rustls-tls = ["kube/client", "kube/rustls-tls", "kube/unstable-client"]
16+
rustls-tls = ["kube/client", "kube/rustls-tls", "kube/ring", "kube/unstable-client"]
1717
runtime = ["kube/runtime", "kube/unstable-runtime"]
1818
socks5 = ["kube/socks5"]
1919
refresh = ["kube/oauth", "kube/oidc"]

kube-client/Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ keywords = ["kubernetes", "client",]
1212
categories = ["web-programming::http-client", "network-programming", "api-bindings"]
1313

1414
[features]
15-
default = ["client"]
15+
default = ["client", "ring"]
1616
rustls-tls = ["rustls", "hyper-rustls", "hyper-http-proxy?/rustls-tls-native-roots"]
1717
webpki-roots = ["hyper-rustls/webpki-roots"]
18-
aws-lc-rs = ["rustls?/aws-lc-rs"]
18+
aws-lc-rs = ["hyper-rustls?/aws-lc-rs"]
19+
ring = ["hyper-rustls?/ring"]
1920
openssl-tls = ["openssl", "hyper-openssl"]
2021
ws = ["client", "tokio-tungstenite", "kube-core/ws", "tokio/macros"]
2122
kubelet-debug = ["ws", "kube-core/kubelet-debug"]
@@ -65,7 +66,7 @@ tokio-util = { workspace = true, features = ["io", "codec"], optional = true }
6566
hyper = { workspace = true, features = ["client", "http1"], optional = true }
6667
hyper-http-proxy = { version = "1", default-features = false, optional = true }
6768
hyper-util = { workspace = true, features = ["client", "client-legacy", "http1", "tokio"], optional = true }
68-
hyper-rustls = { workspace = true, features = ["http1", "logging", "native-tokio", "ring", "tls12"], optional = true }
69+
hyper-rustls = { workspace = true, features = ["http1", "logging", "native-tokio", "tls12"], optional = true }
6970
hyper-socks2 = { workspace = true, optional = true }
7071
tokio-tungstenite = { workspace = true, optional = true }
7172
tower = { workspace = true, features = ["buffer", "filter", "util"], optional = true }
@@ -80,7 +81,7 @@ k8s-openapi= { workspace = true, features = [] }
8081

8182
[dev-dependencies]
8283
hyper = { workspace = true, features = ["server"] }
83-
kube = { path = "../kube", features = ["derive", "client", "ws"], version = "<1.0.0, >=0.61.0" }
84+
kube = { path = "../kube", features = ["derive", "client", "ws", "ring"], version = "<1.0.0, >=0.61.0" }
8485
tempfile.workspace = true
8586
futures = { workspace = true, features = ["async-await"] }
8687
tokio = { workspace = true, features = ["full"] }

kube-client/src/client/auth/oidc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ struct TokenResponse {
254254
id_token: Option<String>,
255255
}
256256

257+
#[cfg(all(feature = "rustls-tls", not(any(feature = "ring", feature = "aws-lc-rs"))))]
258+
compile_error!("At least one of ring or aws-lc-rs feature must be enabled to use rustls-tls feature");
259+
257260
#[cfg(not(any(feature = "rustls-tls", feature = "openssl-tls")))]
258261
compile_error!(
259262
"At least one of rustls-tls or openssl-tls feature must be enabled to use refresh-oidc feature"

kube/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ keywords = ["kubernetes", "client", "runtime", "cncf"]
1212
categories = ["network-programming", "caching", "api-bindings", "encoding"]
1313

1414
[features]
15-
default = ["client", "rustls-tls"]
15+
default = ["client", "rustls-tls", "ring"]
1616

1717
# default features
1818
client = ["kube-client/client", "config"]
@@ -22,6 +22,7 @@ rustls-tls = ["kube-client/rustls-tls", "client"]
2222
# alternative features
2323
openssl-tls = ["kube-client/openssl-tls", "client"]
2424
aws-lc-rs = ["kube-client?/aws-lc-rs"]
25+
ring = ["kube-client?/ring"]
2526

2627
# auxiliary features
2728
ws = ["kube-client/ws", "kube-core/ws"]

0 commit comments

Comments
 (0)