Struct kube::config::Kubeconfig

source ·
pub struct Kubeconfig {
    pub preferences: Option<Preferences>,
    pub clusters: Vec<NamedCluster, Global>,
    pub auth_infos: Vec<NamedAuthInfo, Global>,
    pub contexts: Vec<NamedContext, Global>,
    pub current_context: Option<String>,
    pub extensions: Option<Vec<NamedExtension, Global>>,
    pub kind: Option<String>,
    pub api_version: Option<String>,
}
Available on crate feature config only.
Expand description

Kubeconfig represents information on how to connect to a remote Kubernetes cluster

Stored in ~/.kube/config by default, but can be distributed across multiple paths in passed through KUBECONFIG. An analogue of the config type from client-go.

This type (and its children) are exposed primarily for convenience.

Config is the intended developer interface to help create a Client, and this will handle the difference between in-cluster deployment and local development.

Fields§

§preferences: Option<Preferences>

General information to be use for cli interactions

§clusters: Vec<NamedCluster, Global>

Referencable names to cluster configs

§auth_infos: Vec<NamedAuthInfo, Global>

Referencable names to user configs

§contexts: Vec<NamedContext, Global>

Referencable names to context configs

§current_context: Option<String>

The name of the context that you would like to use by default

§extensions: Option<Vec<NamedExtension, Global>>

Additional information for extenders so that reads and writes don’t clobber unknown fields.

§kind: Option<String>

Legacy field from TypeMeta

§api_version: Option<String>

Legacy field from TypeMeta

Implementations§

Some helpers on the raw Config object are exposed for people needing to parse it

Read a Config from an arbitrary location

Read a Config from an arbitrary YAML string

This is preferable to using serde_yaml::from_str() because it will correctly parse multi-document YAML text and merge them into a single Kubeconfig

Read a Config from KUBECONFIG or the the default location.

Create Kubeconfig from KUBECONFIG environment variable. Supports list of files to be merged.

Panics

Panics if KUBECONFIG value contains the NUL character.

Merge kubeconfig file according to the rules described in https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#merging-kubeconfig-files

Merge the files listed in the KUBECONFIG environment variable according to these rules:

  • Ignore empty filenames.
  • Produce errors for files with content that cannot be deserialized.
  • The first file to set a particular value or map key wins.
  • Never change the value or map key. Example: Preserve the context of the first file to set current-context. Example: If two files specify a red-user, use only values from the first file’s red-user. Even if the second file has non-conflicting entries under red-user, discard them.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

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

Returns the argument unchanged.

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

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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.
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