From 140c9bdaa81e7d0ab81951955e0cc507cee6716e Mon Sep 17 00:00:00 2001 From: Guilherme Oenning Date: Fri, 25 Oct 2024 10:20:40 +0100 Subject: [PATCH] conditionally install `aws-lc-rs` (#1617) conditionally install aws Signed-off-by: goenning Co-authored-by: Eirik A --- kube-client/src/client/auth/oidc.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kube-client/src/client/auth/oidc.rs b/kube-client/src/client/auth/oidc.rs index 820dbf701..2cb679122 100644 --- a/kube-client/src/client/auth/oidc.rs +++ b/kube-client/src/client/auth/oidc.rs @@ -309,9 +309,13 @@ impl Refresher { let client_secret = get_field(Self::CONFIG_CLIENT_SECRET)?.into(); #[cfg(all(feature = "rustls-tls", feature = "aws-lc-rs"))] - rustls::crypto::aws_lc_rs::default_provider() - .install_default() - .unwrap(); + { + if rustls::crypto::CryptoProvider::get_default().is_none() { + // the only error here is if it's been initialized in between: we can ignore it + // since our semantic is only to set the default value if it does not exist. + let _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); + } + } #[cfg(all(feature = "rustls-tls", not(feature = "webpki-roots")))] let https = hyper_rustls::HttpsConnectorBuilder::new()