pub struct Kubeconfig {
pub preferences: Option<Preferences>,
pub clusters: Vec<NamedCluster>,
pub auth_infos: Vec<NamedAuthInfo>,
pub contexts: Vec<NamedContext>,
pub current_context: Option<String>,
pub extensions: Option<Vec<NamedExtension>>,
pub kind: Option<String>,
pub api_version: Option<String>,
}
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>
Referencable names to cluster configs
auth_infos: Vec<NamedAuthInfo>
Referencable names to user configs
contexts: Vec<NamedContext>
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>>
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§
Source§impl Kubeconfig
Some helpers on the raw Config object are exposed for people needing to parse it
impl Kubeconfig
Some helpers on the raw Config object are exposed for people needing to parse it
Sourcepub fn read_from<P: AsRef<Path>>(path: P) -> Result<Kubeconfig, KubeconfigError>
pub fn read_from<P: AsRef<Path>>(path: P) -> Result<Kubeconfig, KubeconfigError>
Read a Config from an arbitrary location
Sourcepub fn from_yaml(text: &str) -> Result<Kubeconfig, KubeconfigError>
pub fn from_yaml(text: &str) -> Result<Kubeconfig, KubeconfigError>
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
Sourcepub fn read() -> Result<Kubeconfig, KubeconfigError>
pub fn read() -> Result<Kubeconfig, KubeconfigError>
Read a Config from KUBECONFIG
or the the default location.
Sourcepub fn from_env() -> Result<Option<Self>, KubeconfigError>
pub fn from_env() -> Result<Option<Self>, KubeconfigError>
Create Kubeconfig
from KUBECONFIG
environment variable.
Supports list of files to be merged.
§Panics
Panics if KUBECONFIG
value contains the NUL character.
Sourcepub fn merge(self, next: Kubeconfig) -> Result<Self, KubeconfigError>
pub fn merge(self, next: Kubeconfig) -> Result<Self, KubeconfigError>
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 ared-user
, use only values from the first file’sred-user
. Even if the second file has non-conflicting entries underred-user
, discard them.
Trait Implementations§
Source§impl Clone for Kubeconfig
impl Clone for Kubeconfig
Source§fn clone(&self) -> Kubeconfig
fn clone(&self) -> Kubeconfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Kubeconfig
impl Debug for Kubeconfig
Source§impl Default for Kubeconfig
impl Default for Kubeconfig
Source§fn default() -> Kubeconfig
fn default() -> Kubeconfig
Source§impl<'de> Deserialize<'de> for Kubeconfig
impl<'de> Deserialize<'de> for Kubeconfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Kubeconfig
impl RefUnwindSafe for Kubeconfig
impl Send for Kubeconfig
impl Sync for Kubeconfig
impl Unpin for Kubeconfig
impl UnwindSafe for Kubeconfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more