Skip to content

Commit

Permalink
change kubeconfig path expansion to use env as well
Browse files Browse the repository at this point in the history
  • Loading branch information
aviramha committed Feb 22, 2024
1 parent acc66c1 commit 7ebb6dc
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),

Check warning on line 77 in mirrord/kube/src/error.rs

View workflow job for this annotation

GitHub Actions / lint

Diff in /home/runner/work/mirrord/mirrord/mirrord/kube/src/error.rs

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

0 comments on commit 7ebb6dc

Please sign in to comment.