Struct kube_client::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
}config only.Expand description
Configuration object detailing things like cluster URL, default namespace, root certificates, and timeouts.
Usage
Construct a Config instance by using one of the many constructors.
Prefer Config::infer unless you have particular issues, and avoid manually managing
the data in this struct unless you have particular needs. It exists to be consumed by the Client.
If you are looking to parse the kubeconfig found in a user’s home directory see Kubeconfig.
Fields
cluster_url: UriThe configured cluster url
default_namespace: StringThe 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: boolWhether 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.
pub async fn from_custom_kubeconfig(
kubeconfig: Kubeconfig,
options: &KubeConfigOptions
) -> Result<Self>
pub async fn from_custom_kubeconfig(
kubeconfig: Kubeconfig,
options: &KubeConfigOptions
) -> Result<Self>
Create configuration from a Kubeconfig struct
This bypasses kube’s normal config parsing to obtain custom functionality.
Trait Implementations
Layer to set the base URI of requests to the configured server.
Optional layer to set up Authorization header depending on the config.
native-tls only.Create native_tls::TlsConnector based on config. Read more
native-tls only.Create hyper_tls::HttpsConnector based on config. Read more
rustls-tls only.Create rustls::ClientConfig based on config. Read more
rustls-tls only.Create hyper_rustls::HttpsConnector based on config. Read more
Auto Trait Implementations
impl RefUnwindSafe for Config
impl UnwindSafe for Config
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more