Code review comment: This should be removed too.

Code before review:
public void createContainer(ContainerName containerName, NodeSpec node, ContainerData containerData) {
PrefixLogger logger = PrefixLogger.getNodeAgentLogger(DockerOperationsImpl.class, containerName);
logger.info("Creating container " + containerName);
Inet6Address ipV6Address = environment.getIpAddresses().getIPv6Address(node.getHostname()).orElseThrow(
() -> new RuntimeException("Unable to find a valid IPv6 address for " + node.getHostname() +
". Missing an AAAA DNS entry?"));
String configServers = String.join(",", environment.getConfigServerHostNames());
Docker.CreateContainerCommand command = docker.createContainerCommand(
node.getWantedDockerImage().get(),
ContainerResources.from(node.getMinCpuCores(), node.getMinMainMemoryAvailableGb()),
containerName,
node.getHostname())
.withManagedBy(MANAGER_NAME)
.withEnvironment("VESPA_CONFIGSERVERS", configServers)
.withEnvironment("CONTAINER_ENVIRONMENT_SETTINGS",
environment.getContainerEnvironmentResolver().createSettings(environment, node))
.withUlimit("nofile", 262_144, 262_144)
.withUlimit("nproc", 32_768, 409_600)
.withUlimit("core", -1, -1)
.withAddCapability("SYS_PTRACE")
.withAddCapability("SYS_ADMIN");
if (environment.getNodeType() == NodeType.confighost ||
environment.getNodeType() == NodeType.proxyhost) {
command.withVolume("/var/lib/sia", "/var/lib/sia");
}
if (environment.getNodeType() == NodeType.proxyhost) {
command.withVolume("/opt/yahoo/share/ssl/certs/", "/opt/yahoo/share/ssl/certs/");
}
if (environment.getNodeType() == NodeType.host) {
Path zpePathInNode = environment.pathInNodeUnderVespaHome("var/zpe");
if (environment.isRunningOnHost()) {
command.withSharedVolume("/var/zpe", zpePathInNode.toString());
} else {
command.withVolume(environment.pathInHostFromPathInNode(containerName, zpePathInNode).toString(), zpePathInNode.toString());
}
}
DockerNetworking networking = environment.getDockerNetworking();
command.withNetworkMode(networking.getDockerNetworkMode());
if (networking == DockerNetworking.MACVLAN) {
command.withIpAddress(ipV6Address);
command.withNetworkMode(DockerImpl.DOCKER_CUSTOM_MACVLAN_NETWORK_NAME);
command.withSharedVolume("/etc/hosts", "/etc/hosts");
} else if (networking == DockerNetworking.NPT) {
InetAddress ipV6Prefix = InetAddresses.forString(IPV6_NPT_PREFIX);
InetAddress ipV6Local = IPAddresses.prefixTranslate(ipV6Address, ipV6Prefix, 8);
command.withIpAddress(ipV6Local);
Optional<InetAddress> ipV4Local = environment.getIpAddresses().getIPv4Address(node.getHostname())
.map(ipV4Address -> {
InetAddress ipV4Prefix = InetAddresses.forString(IPV4_NPT_PREFIX);
return IPAddresses.prefixTranslate(ipV4Address, ipV4Prefix, 2);
});
ipV4Local.ifPresent(command::withIpAddress);
addEtcHosts(containerData, node.getHostname(), ipV4Local, ipV6Local);
}
for (Path pathInNode : directoriesToMount.keySet()) {
String pathInHost = environment.pathInHostFromPathInNode(containerName, pathInNode).toString();
command.withVolume(pathInHost, pathInNode.toString());
}
long minMainMemoryAvailableMb = (long) (node.getMinMainMemoryAvailableGb() * 1024);
if (minMainMemoryAvailableMb > 0) {
command.withEnvironment("VESPA_TOTAL_MEMORY_MB", Long.toString(minMainMemoryAvailableMb));
}
logger.info("Creating new container with args: " + command);
command.create();
docker.createContainer(command);
}

Line under review: command.withNetworkMode(DockerImpl.DOCKER_CUSTOM_MACVLAN_NETWORK_NAME);

Code after addressing the review:
public void createContainer(ContainerName containerName, NodeSpec node, ContainerData containerData) {
PrefixLogger logger = PrefixLogger.getNodeAgentLogger(DockerOperationsImpl.class, containerName);
logger.info("Creating container " + containerName);
Inet6Address ipV6Address = environment.getIpAddresses().getIPv6Address(node.getHostname()).orElseThrow(
() -> new RuntimeException("Unable to find a valid IPv6 address for " + node.getHostname() +
". Missing an AAAA DNS entry?"));
String configServers = String.join(",", environment.getConfigServerHostNames());
Docker.CreateContainerCommand command = docker.createContainerCommand(
node.getWantedDockerImage().get(),
ContainerResources.from(node.getMinCpuCores(), node.getMinMainMemoryAvailableGb()),
containerName,
node.getHostname())
.withManagedBy(MANAGER_NAME)
.withEnvironment("VESPA_CONFIGSERVERS", configServers)
.withEnvironment("CONTAINER_ENVIRONMENT_SETTINGS",
environment.getContainerEnvironmentResolver().createSettings(environment, node))
.withUlimit("nofile", 262_144, 262_144)
.withUlimit("nproc", 32_768, 409_600)
.withUlimit("core", -1, -1)
.withAddCapability("SYS_PTRACE")
.withAddCapability("SYS_ADMIN");
if (environment.getNodeType() == NodeType.confighost ||
environment.getNodeType() == NodeType.proxyhost) {
command.withVolume("/var/lib/sia", "/var/lib/sia");
}
if (environment.getNodeType() == NodeType.proxyhost) {
command.withVolume("/opt/yahoo/share/ssl/certs/", "/opt/yahoo/share/ssl/certs/");
}
if (environment.getNodeType() == NodeType.host) {
Path zpePathInNode = environment.pathInNodeUnderVespaHome("var/zpe");
if (environment.isRunningOnHost()) {
command.withSharedVolume("/var/zpe", zpePathInNode.toString());
} else {
command.withVolume(environment.pathInHostFromPathInNode(containerName, zpePathInNode).toString(), zpePathInNode.toString());
}
}
DockerNetworking networking = environment.getDockerNetworking();
command.withNetworkMode(networking.getDockerNetworkMode());
if (networking == DockerNetworking.MACVLAN) {
command.withIpAddress(ipV6Address);
command.withSharedVolume("/etc/hosts", "/etc/hosts");
} else if (networking == DockerNetworking.NPT) {
InetAddress ipV6Prefix = InetAddresses.forString(IPV6_NPT_PREFIX);
InetAddress ipV6Local = IPAddresses.prefixTranslate(ipV6Address, ipV6Prefix, 8);
command.withIpAddress(ipV6Local);
Optional<InetAddress> ipV4Local = environment.getIpAddresses().getIPv4Address(node.getHostname())
.map(ipV4Address -> {
InetAddress ipV4Prefix = InetAddresses.forString(IPV4_NPT_PREFIX);
return IPAddresses.prefixTranslate(ipV4Address, ipV4Prefix, 2);
});
ipV4Local.ifPresent(command::withIpAddress);
addEtcHosts(containerData, node.getHostname(), ipV4Local, ipV6Local);
}
for (Path pathInNode : directoriesToMount.keySet()) {
String pathInHost = environment.pathInHostFromPathInNode(containerName, pathInNode).toString();
command.withVolume(pathInHost, pathInNode.toString());
}
long minMainMemoryAvailableMb = (long) (node.getMinMainMemoryAvailableGb() * 1024);
if (minMainMemoryAvailableMb > 0) {
command.withEnvironment("VESPA_TOTAL_MEMORY_MB", Long.toString(minMainMemoryAvailableMb));
}
logger.info("Creating new container with args: " + command);
command.create();
docker.createContainer(command);
}