Struct kube::Config[][src]

pub struct Config {
    pub cluster_url: Uri,
    pub default_namespace: String,
    pub root_cert: Option<Vec<Vec<u8>>>,
    pub timeout: Option<Duration>,
    pub accept_invalid_certs: bool,
    pub proxy_url: Option<Uri>,
    // some fields omitted
}
This is supported on crate feature config only.
Expand description

Configuration object detailing things like cluster URL, default namespace, root certificates, and timeouts.

Fields

cluster_url: Uri

The configured cluster url

default_namespace: String

The configured default namespace

root_cert: Option<Vec<Vec<u8>>>

The configured root certificate

timeout: Option<Duration>

Timeout for calls to the Kubernetes API.

A value of None means no timeout

accept_invalid_certs: bool

Whether to accept invalid ceritifacts

proxy_url: Option<Uri>

Optional proxy URL.

Implementations

Construct a new config where only the cluster_url is set by the user. and everything else receives a default value.

Most likely you want to use Config::infer to infer the config from the environment.

Infer the configuration from the environment

Done by attempting to load in-cluster environment variables first, and then if that fails, trying the local kubeconfig.

Fails if inference from both sources fails

Create configuration from the cluster’s environment variables

This follows the standard API Access from a Pod and relies on you having the service account’s token mounted, as well as having given the service account rbac access to do what you need.

Create configuration from the default local config file

This will respect the $KUBECONFIG evar, but otherwise default to ~/.kube/config. You can also customize what context/cluster/user you want to use here, but it will default to the current-context.

Create configuration from a Kubeconfig struct

This bypasses kube’s normal config parsing to obtain custom functionality. Like if you need stacked kubeconfigs for instance - see #132

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Layer to set the base URI of requests to the configured server.

Optional layer to set up Authorization header depending on the config.

This is supported on crate feature native-tls only.

Create native_tls::TlsConnector based on config. Read more

This is supported on crate feature native-tls only.

Create hyper_tls::HttpsConnector based on config. Read more

This is supported on crate feature rustls-tls only.

Create rustls::ClientConfig based on config. Read more

This is supported on crate feature rustls-tls only.

Create hyper_rustls::HttpsConnector based on config. Read more

Formats the value using the given formatter. Read more

Convert Config into a Client

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.