YARN-7814. Remove automatic mounting of the cgroups root directory into Docker containers. Contributed by Shane Kumpf.
This commit is contained in:
parent
cc10852252
commit
2e5865606b
@ -230,7 +230,6 @@ public class DockerLinuxContainerRuntime implements LinuxContainerRuntime {
|
||||
private PrivilegedOperationExecutor privilegedOperationExecutor;
|
||||
private Set<String> allowedNetworks = new HashSet<>();
|
||||
private String defaultNetwork;
|
||||
private String cgroupsRootDirectory;
|
||||
private CGroupsHandler cGroupsHandler;
|
||||
private AccessControlList privilegedContainersAcl;
|
||||
private boolean enableUserReMapping;
|
||||
@ -290,7 +289,6 @@ public DockerLinuxContainerRuntime(
|
||||
LOG.info("cGroupsHandler is null - cgroups not in use.");
|
||||
} else {
|
||||
this.cGroupsHandler = cGroupsHandler;
|
||||
this.cgroupsRootDirectory = cGroupsHandler.getCGroupMountPath();
|
||||
}
|
||||
}
|
||||
|
||||
@ -796,11 +794,6 @@ public void launchContainer(ContainerRuntimeContext ctx)
|
||||
setHostname(runCommand, containerIdStr, hostname);
|
||||
runCommand.setCapabilities(capabilities);
|
||||
|
||||
if(cgroupsRootDirectory != null) {
|
||||
runCommand.addReadOnlyMountLocation(cgroupsRootDirectory,
|
||||
cgroupsRootDirectory, false);
|
||||
}
|
||||
|
||||
List<String> allDirs = new ArrayList<>(containerLocalDirs);
|
||||
allDirs.addAll(filecacheDirs);
|
||||
allDirs.add(containerWorkDir.toString());
|
||||
|
@ -37,7 +37,6 @@
|
||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.privileged.PrivilegedOperationException;
|
||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.privileged.PrivilegedOperationExecutor;
|
||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsHandler;
|
||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.ResourceHandlerModule;
|
||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.runtime.docker.DockerCommandExecutor;
|
||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.runtime.docker.DockerKillCommand;
|
||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.runtime.docker.DockerRmCommand;
|
||||
@ -332,24 +331,6 @@ private String getExpectedTestCapabilitiesArgumentString() {
|
||||
return expectedCapabilitiesString.toString();
|
||||
}
|
||||
|
||||
private String getExpectedCGroupsMountString() {
|
||||
CGroupsHandler cgroupsHandler = ResourceHandlerModule.getCGroupsHandler();
|
||||
if(cgroupsHandler == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String cgroupMountPath = cgroupsHandler.getCGroupMountPath();
|
||||
boolean cGroupsMountExists = new File(
|
||||
cgroupMountPath).exists();
|
||||
|
||||
if(cGroupsMountExists) {
|
||||
return "-v " + cgroupMountPath
|
||||
+ ":" + cgroupMountPath + ":ro ";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDockerContainerLaunch()
|
||||
throws ContainerExecutionException, PrivilegedOperationException,
|
||||
|
Loading…
Reference in New Issue
Block a user