diff options
author | Valerij Fredriksen <valerijf@oath.com> | 2018-11-09 15:39:21 +0100 |
---|---|---|
committer | Valerij Fredriksen <valerijf@oath.com> | 2018-11-13 15:54:43 +0100 |
commit | 58381506bcc89c8d91b5a3a4890e30a4d3c6ea90 (patch) | |
tree | 0becbdc62c92bde4f320336c098bf7fdcb060195 /node-admin/src | |
parent | 03c01d5476f9884b31328e8301e5e6e7bf7752ab (diff) |
Remove ContainerEnvironmentResolver
Diffstat (limited to 'node-admin/src')
4 files changed, 2 insertions, 53 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/ContainerEnvironmentResolver.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/ContainerEnvironmentResolver.java deleted file mode 100644 index f1218efa67c..00000000000 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/ContainerEnvironmentResolver.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.hosted.node.admin.component; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.yahoo.vespa.hosted.node.admin.configserver.noderepository.NodeSpec; - -import java.util.HashMap; -import java.util.Map; - -/** - * For creating environment variables that should be available inside a Docker container. - * An environment variable CONTAINER_ENVIRONMENT_SETTINGS with the settings here will be - * available inside the container. Serializing happens in ContainerEnvironmentSetting in this interface. - * - * @author hmusum - */ -@FunctionalInterface -public interface ContainerEnvironmentResolver { - - String createSettings(NodeSpec node); - - class ContainerEnvironmentSettings { - - @JsonProperty(value = "environmentVariables") - private final Map<String, Object> variables = new HashMap<>(); - - public ContainerEnvironmentSettings set(String argument, Object value) { - variables.put(argument, value); - return this; - } - - public String build() { - ObjectMapper objectMapper = new ObjectMapper(); - try { - return objectMapper.writeValueAsString(this); - } catch (JsonProcessingException e) { - throw new IllegalArgumentException("Could not write " + this, e); - } - } - } - -} diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java index a6879e57a5e..b27e2033834 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java @@ -12,7 +12,6 @@ import com.yahoo.vespa.hosted.dockerapi.ContainerStats; import com.yahoo.vespa.hosted.dockerapi.Docker; import com.yahoo.vespa.hosted.dockerapi.DockerImage; import com.yahoo.vespa.hosted.dockerapi.ProcessResult; -import com.yahoo.vespa.hosted.node.admin.component.ContainerEnvironmentResolver; import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentContext; import com.yahoo.vespa.hosted.node.admin.configserver.noderepository.NodeSpec; import com.yahoo.vespa.hosted.node.admin.nodeagent.ContainerData; @@ -47,16 +46,13 @@ public class DockerOperationsImpl implements DockerOperations { private final Docker docker; private final ProcessExecuter processExecuter; - private final ContainerEnvironmentResolver containerEnvironmentResolver; private final List<String> configServerHostnames; private final IPAddresses ipAddresses; public DockerOperationsImpl(Docker docker, ProcessExecuter processExecuter, - ContainerEnvironmentResolver containerEnvironmentResolver, List<String> configServerHostnames, IPAddresses ipAddresses) { this.docker = docker; this.processExecuter = processExecuter; - this.containerEnvironmentResolver = containerEnvironmentResolver; this.configServerHostnames = configServerHostnames; this.ipAddresses = ipAddresses; } @@ -79,7 +75,6 @@ public class DockerOperationsImpl implements DockerOperations { node.getHostname()) .withManagedBy(MANAGER_NAME) .withEnvironment("VESPA_CONFIGSERVERS", configServers) - .withEnvironment("CONTAINER_ENVIRONMENT_SETTINGS", containerEnvironmentResolver.createSettings(node)) .withUlimit("nofile", 262_144, 262_144) .withUlimit("nproc", 32_768, 409_600) .withUlimit("core", -1, -1) diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImplTest.java index 6e8cfce6c37..d93d33617e3 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImplTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImplTest.java @@ -9,7 +9,6 @@ import com.yahoo.vespa.hosted.dockerapi.ContainerName; import com.yahoo.vespa.hosted.dockerapi.Docker; import com.yahoo.vespa.hosted.dockerapi.DockerImage; import com.yahoo.vespa.hosted.dockerapi.ProcessResult; -import com.yahoo.vespa.hosted.node.admin.component.ContainerEnvironmentResolver; import com.yahoo.vespa.hosted.node.admin.nodeagent.ContainerData; import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentContext; import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentContextImpl; @@ -39,10 +38,9 @@ import static org.mockito.Mockito.when; public class DockerOperationsImplTest { private final Docker docker = mock(Docker.class); private final ProcessExecuter processExecuter = mock(ProcessExecuter.class); - private final ContainerEnvironmentResolver containerEnvironmentResolver = node -> ""; private final IPAddresses ipAddresses = new IPAddressesMock(); private final DockerOperationsImpl dockerOperations = new DockerOperationsImpl( - docker, processExecuter, containerEnvironmentResolver, Collections.emptyList(), ipAddresses); + docker, processExecuter, Collections.emptyList(), ipAddresses); @Test public void processResultFromNodeProgramWhenSuccess() { diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/DockerTester.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/DockerTester.java index e22606104f1..9385e604142 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/DockerTester.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/DockerTester.java @@ -90,7 +90,7 @@ public class DockerTester implements AutoCloseable { Clock clock = Clock.systemUTC(); FileSystem fileSystem = TestFileSystem.create(); - DockerOperations dockerOperations = new DockerOperationsImpl(docker, processExecuter, node -> "", Collections.emptyList(), ipAddresses); + DockerOperations dockerOperations = new DockerOperationsImpl(docker, processExecuter, Collections.emptyList(), ipAddresses); MetricReceiverWrapper mr = new MetricReceiverWrapper(MetricReceiver.nullImplementation); Function<String, NodeAgent> nodeAgentFactory = (hostName) -> new NodeAgentImpl( |