Skip to content

Commit

Permalink
add drop_env to ExecConfig to control passed environment variables
Browse files Browse the repository at this point in the history
Signed-off-by: Aviram Hassan <aviramyhassan@gmail.com>
  • Loading branch information
aviramha committed Oct 28, 2022
1 parent e104bea commit 2c59a59
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kube-client/src/client/auth/mod.rs
Expand Up @@ -474,6 +474,13 @@ fn auth_exec(auth: &ExecConfig) -> Result<ExecCredential, Error> {
});
cmd.envs(envs);
}

if let Some(envs) = &auth.drop_env {
for env in envs {
cmd.env_remove(env);
}
}

let out = cmd.output().map_err(Error::AuthExecStart)?;
if !out.status.success() {
return Err(Error::AuthExecRun {
Expand Down
5 changes: 5 additions & 0 deletions kube-client/src/config/file_config.rs
Expand Up @@ -243,6 +243,11 @@ pub struct ExecConfig {
/// TODO: These are unioned with the host's environment, as well as variables client-go uses to pass argument to the plugin.
#[serde(skip_serializing_if = "Option::is_none")]
pub env: Option<Vec<HashMap<String, String>>>,
/// drop_env specifies which environment arguments of the host process shouldn't
/// pass to the auth plugin.
/// This doesn't exist upstream (yet?)
#[serde(skip)]
pub drop_env: Option<Vec<String>>,
}

/// NamedContext associates name with context.
Expand Down

0 comments on commit 2c59a59

Please sign in to comment.