|
7 | 7 | //!
|
8 | 8 | //! The [`Client`] can also be used with [`Discovery`](crate::Discovery) to dynamically
|
9 | 9 | //! retrieve the resources served by the kubernetes API.
|
| 10 | +//! |
| 11 | +//! ## Configuring TLS |
| 12 | +//! |
| 13 | +//! The Kubernetes client provided by this crate can be configured to use TLS |
| 14 | +//! when connecting to the Kubernetes API. A variety of TLS implementations may |
| 15 | +//! be used as the backend for `kube-client`'s TLS support, with the choice of |
| 16 | +//! TLS backend controlled by crate feature flags. The following TLS backends |
| 17 | +//! are available: |
| 18 | +//! |
| 19 | +//! | TLS backend | Crate feature flag | Description | |
| 20 | +//! |:------------|--------------------|-------------| |
| 21 | +//! | `<none>` | `<none>` | When no TLS feature flag is enabled, communication with the Kubernetes API is plaintext. | |
| 22 | +//! | [Rustls] | `rustls-tls` | [Rustls] is a pure-Rust TLS implementation. | |
| 23 | +//! | [OpenSSL] | `openssl-tls` | [OpenSSL] is a popular TLS implementation written in C. This feature uses the [`openssl` crate]'s Rust bindings for OpenSSL. | |
| 24 | +//! | [BoringSSL] | `boring-tls` | [BoringSSL] is a fork of OpenSSL maintained by Google. This feature uses the [`boring` crate]'s Rust bindings for BoringSSL. | |
| 25 | +//! |
| 26 | +//! Since crate feature flags are additive, more than one TLS feature may be |
| 27 | +//! enabled at the same time. However, only one TLS backend may actually be |
| 28 | +//! selected. Therefore, conflicts are resolved by selecting one TLS backend, |
| 29 | +//! with the following order of priority: |
| 30 | +//! |
| 31 | +//! 1. **rustls-tls**: If the `rustls-tls` feature is enabled, [Rustls] is |
| 32 | +//! always used as the TLS implementation, regardless of what other feature |
| 33 | +//! flags are enabled. |
| 34 | +//! 2. **openssl-tls**: If the `rustls-tls` feature is not enabled, but the |
| 35 | +//! `openssl-tls` feature flag is enabled, then [OpenSSL] is used instead of |
| 36 | +//! Rustls. |
| 37 | +//! 3. **boring-tls**: If neither the `rustls-tls` nor `openssl-tls` features |
| 38 | +//! are enabled, [BoringSSL] is used as the TLS backend. |
| 39 | +//! 4. **none**: If none of the `rustls-tls`, `openssl-tls`, and `boring-tls` |
| 40 | +//! features are enabled, all communication with the Kubernetes API is |
| 41 | +//! plaintext. |
| 42 | +//! |
| 43 | +//! [Rustls]: https://crates.io/crates/rustls |
| 44 | +//! [OpenSSL]: https://www.openssl.org/ |
| 45 | +//! [`openssl` crate]: https://crates.io/crates/openssl |
| 46 | +//! [BoringSSL]: https://github.com/google/boringssl |
| 47 | +//! [`boring` crate]: https://crates.io/crates/boring |
10 | 48 | use either::{Either, Left, Right};
|
11 | 49 | use futures::{self, AsyncBufRead, StreamExt, TryStream, TryStreamExt};
|
12 | 50 | use http::{self, Request, Response, StatusCode};
|
@@ -131,6 +169,10 @@ impl Client {
|
131 | 169 | ///
|
132 | 170 | /// If you already have a [`Config`] then use [`Client::try_from`](Self::try_from)
|
133 | 171 | /// instead.
|
| 172 | + /// |
| 173 | + /// The TLS implementation used by the returned client depends on which |
| 174 | + /// crate feature flags are enabled. See [the documentation on configuring |
| 175 | + /// TLS](crate::client#configuring-tls) for details. |
134 | 176 | pub async fn try_default() -> Result<Self> {
|
135 | 177 | Self::try_from(Config::infer().await.map_err(Error::InferConfig)?)
|
136 | 178 | }
|
|
0 commit comments