Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix custom client tls ex #1619

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
# Examples
- name: Test examples
if: matrix.os != 'windows-latest'
run: cargo test -p kube-examples --examples -j6
run: cargo test -p kube-examples --examples -j6 --all-features

doc:
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion examples/custom_client_tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use hyper_util::rt::TokioExecutor;
// Must enable `rustls-tls` feature to run this.
// Run with `USE_RUSTLS=1` to pick rustls.
use k8s_openapi::api::core::v1::Pod;
use tower::ServiceBuilder;
use tower::{BoxError, ServiceBuilder};
use tracing::*;

use kube::{client::ConfigExt, Api, Client, Config, ResourceExt};
Expand All @@ -21,13 +21,15 @@ async fn main() -> anyhow::Result<()> {
let service = ServiceBuilder::new()
.layer(config.base_uri_layer())
.option_layer(config.auth_layer()?)
.map_err(BoxError::from)
.service(hyper_util::client::legacy::Client::builder(TokioExecutor::new()).build(https));
Client::new(service, config.default_namespace)
} else {
let https = config.rustls_https_connector()?;
let service = ServiceBuilder::new()
.layer(config.base_uri_layer())
.option_layer(config.auth_layer()?)
.map_err(BoxError::from)
.service(hyper_util::client::legacy::Client::builder(TokioExecutor::new()).build(https));
Client::new(service, config.default_namespace)
};
Expand Down
Loading