Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change kubeconfig path expansion to use env as well #2263

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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),
}
Loading