/// 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
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
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
pub async fn infer() -> Result<Self> {
        match Self::from_cluster_env() {
            Err(cluster_env_err) => {
                trace!("No in-cluster config found: {}", cluster_env_err);
                trace!("Falling back to local kubeconfig");
                let config = Self::from_kubeconfig(&KubeConfigOptions::default())
                    .await
                    .map_err(|kubeconfig_err| ConfigError::ConfigInferenceExhausted {
                        cluster_env: Box::new(cluster_env_err),
                        kubeconfig: Box::new(kubeconfig_err),
                    })?;
                Ok(config)
            }
            success => success,
        }
    }
pub async fn infer ( ) -> Result < Self > { match Self :: from_cluster_env ( ) { Err ( cluster_env_err ) => { trace ! ( " " cluster_env_err ) ; trace ! ( " " ) ; let config = Self :: from_kubeconfig ( & KubeConfigOptions :: default ( ) ) . await . map_err ( | kubeconfig_err | ConfigError :: ConfigInferenceExhausted { cluster_env : Box :: new ( cluster_env_err ) , kubeconfig : Box :: new ( kubeconfig_err ) , } ) ? ; Ok ( config ) } success => success , } }
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.
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 .