YARN-9391. Fixed node manager environment leaks into Docker containers.
Contributed by Jim Brennan
(cherry picked from commit 3c45762a0b
)
This commit is contained in:
parent
ade3af6ef2
commit
10642a6205
|
@ -406,16 +406,6 @@ public abstract class ContainerExecutor implements Configurable {
|
|||
sb.env(env.getKey(), env.getValue());
|
||||
}
|
||||
}
|
||||
// Add the whitelist vars to the environment. Do this after writing
|
||||
// environment variables so they are not written twice.
|
||||
for(String var : whitelistVars) {
|
||||
if (!environment.containsKey(var)) {
|
||||
String val = getNMEnvVar(var);
|
||||
if (val != null) {
|
||||
environment.put(var, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (resources != null) {
|
||||
|
|
|
@ -468,10 +468,15 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
|
|||
for (String envVar : env.keySet()) {
|
||||
Assert.assertTrue(shellContent.contains(envVar + "="));
|
||||
}
|
||||
// The whitelist vars should not have been added to env
|
||||
// They should only be in the launch script
|
||||
for (String wlVar : whitelistVars) {
|
||||
Assert.assertFalse(env.containsKey(wlVar));
|
||||
Assert.assertTrue(shellContent.contains(wlVar + "="));
|
||||
}
|
||||
// Non-whitelist nm vars should be in neither env nor in launch script
|
||||
for (String nwlVar : nonWhiteListEnv) {
|
||||
Assert.assertFalse(env.containsKey(nwlVar));
|
||||
Assert.assertFalse(shellContent.contains(nwlVar + "="));
|
||||
}
|
||||
// Explicitly Set NM vars should be before user vars
|
||||
|
|
Loading…
Reference in New Issue