Skip to content

Commit

Permalink
change kubeconfig path expansion to use env as well (#2263)
Browse files Browse the repository at this point in the history
* change kubeconfig path expansion to use env as well

* ..
  • Loading branch information
aviramha authored Feb 22, 2024
1 parent acc66c1 commit ca91fa8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/2262.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
change kubeconfig path expansion to use env as well
3 changes: 2 additions & 1 deletion mirrord/kube/src/api/kubernetes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ where
};

let mut config = if let Some(kubeconfig) = kubeconfig {
let kubeconfig = shellexpand::tilde(&kubeconfig);
let kubeconfig = shellexpand::full(&kubeconfig)
.map_err(|e| KubeApiError::ConfigPathExpansionError(e.to_string()))?;
let parsed_kube_config = Kubeconfig::read_from(kubeconfig.deref())?;
Config::from_custom_kubeconfig(parsed_kube_config, &kube_config_opts).await?
} else if kube_config_opts.context.is_some() {
Expand Down
3 changes: 3 additions & 0 deletions mirrord/kube/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,7 @@ pub enum KubeApiError {

#[error("Node {0:?} is too full with {1} pods")]
NodePodLimitExceeded(String, usize),

#[error("Path expansion for kubeconfig failed: {0}")]
ConfigPathExpansionError(String),
}

0 comments on commit ca91fa8

Please sign in to comment.