Skip to content

Commit

Permalink
add cmd-drop-env to AuthProviderConfig
Browse files Browse the repository at this point in the history
Co-authored-by: Eirik A <sszynrae@gmail.com>
Signed-off-by: Aviram Hassan <aviramyhassan@gmail.com>
  • Loading branch information
aviramha and clux committed Nov 19, 2022
1 parent f6ca7df commit 24c98b1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions kube-client/src/client/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,16 @@ fn token_from_gcp_provider(provider: &AuthProviderConfig) -> Result<ProviderToke
// Command-based token source
if let Some(cmd) = provider.config.get("cmd-path") {
let params = provider.config.get("cmd-args").cloned().unwrap_or_default();

// NB: This property does currently not exist upstream in client-go
// See https://github.com/kube-rs/kube/issues/1060
let drop_env = provider.config.get("cmd-drop-env").cloned().unwrap_or_default();
// TODO splitting args by space is not safe
let output = Command::new(cmd)
let mut command = Command::new(cmd);
// Do not pass the following env vars to the command
for env in drop_env.trim().split(' ') {
command.env_remove(env);
}
let output = command
.args(params.trim().split(' '))
.output()
.map_err(|e| Error::AuthExec(format!("Executing {:} failed: {:?}", cmd, e)))?;
Expand Down

0 comments on commit 24c98b1

Please sign in to comment.