diff options
10 files changed, 45 insertions, 40 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServerClient.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java index 089cba4fe43..44c6d899360 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServerClient.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java @@ -17,9 +17,11 @@ import java.util.Optional; import java.util.Set; /** + * The API controllers use when communicating with config servers. + * * @author Oyvind Grønnesby */ -public interface ConfigServerClient { +public interface ConfigServer { interface PreparedApplication { void activate(); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java index 05bfc2fd2c0..0749e49729f 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java @@ -1,4 +1,4 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// 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.controller; import com.google.common.collect.ImmutableList; @@ -7,7 +7,6 @@ import com.yahoo.config.application.api.DeploymentSpec; import com.yahoo.config.application.api.ValidationId; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Environment; -import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.TenantName; import com.yahoo.vespa.athenz.api.NToken; import com.yahoo.vespa.curator.Lock; @@ -21,7 +20,7 @@ import com.yahoo.vespa.hosted.controller.api.identifiers.RevisionId; import com.yahoo.vespa.hosted.controller.api.integration.BuildService; import com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzClientFactory; import com.yahoo.vespa.hosted.controller.api.integration.athenz.ZmsClient; -import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerClient; +import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServer; import com.yahoo.vespa.hosted.controller.api.integration.configserver.Log; import com.yahoo.vespa.hosted.controller.api.integration.configserver.NoInstanceException; import com.yahoo.vespa.hosted.controller.api.integration.configserver.PrepareResponse; @@ -88,7 +87,7 @@ public class ApplicationController { private final RotationRepository rotationRepository; private final AthenzClientFactory zmsClientFactory; private final NameService nameService; - private final ConfigServerClient configServer; + private final ConfigServer configServer; private final RoutingGenerator routingGenerator; private final Clock clock; @@ -96,7 +95,7 @@ public class ApplicationController { ApplicationController(Controller controller, CuratorDb curator, AthenzClientFactory zmsClientFactory, RotationsConfig rotationsConfig, - NameService nameService, ConfigServerClient configServer, + NameService nameService, ConfigServer configServer, ArtifactRepository artifactRepository, RoutingGenerator routingGenerator, BuildService buildService, Clock clock) { this.controller = controller; @@ -336,7 +335,7 @@ public class ApplicationController { options = withVersion(platformVersion, options); DeploymentId deploymentId = new DeploymentId(applicationId, zone); - ConfigServerClient.PreparedApplication preparedApplication = + ConfigServer.PreparedApplication preparedApplication = configServer.deploy(deploymentId, options, cnames, rotationNames, applicationPackage.zippedContent()); // TODO: Set new deployment after convergence, rather than after deployment call, succeeds. application = application.withNewDeployment(zone, applicationVersion, platformVersion, clock.instant()); @@ -584,7 +583,7 @@ public class ApplicationController { id.instance().value()); } - public ConfigServerClient configServer() { return configServer; } + public ConfigServer configServer() { return configServer; } /** * Returns a lock which provides exclusive rights to changing this application. diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java index f7757d2a335..c94cbb79162 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java @@ -16,7 +16,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.BuildService; import com.yahoo.vespa.hosted.controller.api.integration.MetricsService; import com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzClientFactory; import com.yahoo.vespa.hosted.controller.api.integration.chef.Chef; -import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerClient; +import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServer; import com.yahoo.vespa.hosted.controller.api.integration.deployment.ArtifactRepository; import com.yahoo.vespa.hosted.controller.api.integration.dns.NameService; import com.yahoo.vespa.hosted.controller.api.integration.entity.EntityService; @@ -68,7 +68,7 @@ public class Controller extends AbstractComponent { private final EntityService entityService; private final GlobalRoutingService globalRoutingService; private final ZoneRegistry zoneRegistry; - private final ConfigServerClient configServer; + private final ConfigServer configServer; private final NodeRepositoryClientInterface nodeRepository; private final MetricsService metricsService; private final Chef chef; @@ -84,7 +84,7 @@ public class Controller extends AbstractComponent { public Controller(CuratorDb curator, RotationsConfig rotationsConfig, GitHub gitHub, EntityService entityService, Organization organization, GlobalRoutingService globalRoutingService, - ZoneRegistry zoneRegistry, ConfigServerClient configServer, NodeRepositoryClientInterface nodeRepository, + ZoneRegistry zoneRegistry, ConfigServer configServer, NodeRepositoryClientInterface nodeRepository, MetricsService metricsService, NameService nameService, RoutingGenerator routingGenerator, Chef chef, AthenzClientFactory athenzClientFactory, ArtifactRepository artifactRepository, BuildService buildService) { @@ -98,7 +98,7 @@ public class Controller extends AbstractComponent { public Controller(CuratorDb curator, RotationsConfig rotationsConfig, GitHub gitHub, EntityService entityService, Organization organization, GlobalRoutingService globalRoutingService, - ZoneRegistry zoneRegistry, ConfigServerClient configServer, NodeRepositoryClientInterface nodeRepository, + ZoneRegistry zoneRegistry, ConfigServer configServer, NodeRepositoryClientInterface nodeRepository, MetricsService metricsService, NameService nameService, RoutingGenerator routingGenerator, Chef chef, Clock clock, AthenzClientFactory athenzClientFactory, ArtifactRepository artifactRepository, @@ -111,7 +111,7 @@ public class Controller extends AbstractComponent { this.organization = Objects.requireNonNull(organization, "Organization cannot be null"); this.globalRoutingService = Objects.requireNonNull(globalRoutingService, "GlobalRoutingService cannot be null"); this.zoneRegistry = Objects.requireNonNull(zoneRegistry, "ZoneRegistry cannot be null");; - this.configServer = Objects.requireNonNull(configServer, "ConfigServerClient cannot be null");; + this.configServer = Objects.requireNonNull(configServer, "ConfigServer cannot be null");; this.nodeRepository = Objects.requireNonNull(nodeRepository, "NodeRepositoryClientInterface cannot be null"); this.metricsService = Objects.requireNonNull(metricsService, "MetricsService cannot be null"); this.chef = Objects.requireNonNull(chef, "Chef cannot be null"); @@ -176,10 +176,6 @@ public class Controller extends AbstractComponent { serviceName, restPath); } - public GitHub gitHub() { - return gitHub; - } - /** Replace the current version status by a new one */ public void updateVersionStatus(VersionStatus newStatus) { VersionStatus currentStatus = versionStatus(); @@ -217,10 +213,18 @@ public class Controller extends AbstractComponent { return HostName.from(hostnameSupplier.get()); } + public GitHub gitHub() { + return gitHub; + } + public MetricsService metricsService() { return metricsService; } + public ConfigServer configServer() { + return configServer; + } + public SystemName system() { return zoneRegistry.system(); } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/VersionStatus.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/VersionStatus.java index 1f72edf9538..05881d2c466 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/VersionStatus.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/VersionStatus.java @@ -133,7 +133,7 @@ public class VersionStatus { ListMap<Version, HostName> versions = new ListMap<>(); for (URI configServer : configServers) - versions.put(controller.applications().configServer().version(configServer), + versions.put(controller.configServer().version(configServer), HostName.from(configServer.getHost())); return versions; } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ConfigServerClientMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ConfigServerMock.java index 44aff188079..576bb33687b 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ConfigServerClientMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ConfigServerMock.java @@ -13,7 +13,7 @@ import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbi import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; import com.yahoo.vespa.hosted.controller.api.identifiers.Hostname; import com.yahoo.vespa.hosted.controller.api.identifiers.TenantId; -import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerClient; +import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServer; import com.yahoo.vespa.hosted.controller.api.integration.configserver.Log; import com.yahoo.vespa.hosted.controller.api.integration.configserver.PrepareResponse; import com.yahoo.vespa.serviceview.bindings.ApplicationView; @@ -33,7 +33,7 @@ import java.util.Set; /** * @author mortent */ -public class ConfigServerClientMock extends AbstractComponent implements ConfigServerClient { +public class ConfigServerMock extends AbstractComponent implements ConfigServer { private final Map<ApplicationId, Boolean> applicationActivated = new HashMap<>(); private final Map<String, EndpointStatus> endpoints = new HashMap<>(); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java index c098e49dbcb..b4bc8140aca 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java @@ -59,7 +59,7 @@ public final class ControllerTester { private final AthenzDbMock athenzDb; private final ManualClock clock; - private final ConfigServerClientMock configServer; + private final ConfigServerMock configServer; private final ZoneRegistryMock zoneRegistry; private final GitHubMock gitHub; private final CuratorDb curator; @@ -72,31 +72,31 @@ public final class ControllerTester { private Controller controller; public ControllerTester() { - this(new AthenzDbMock(), new ManualClock(), new ConfigServerClientMock(), + this(new AthenzDbMock(), new ManualClock(), new ConfigServerMock(), new ZoneRegistryMock(), new GitHubMock(), new MockCuratorDb(), defaultRotationsConfig(), new MemoryNameService(), new ArtifactRepositoryMock(), new MemoryEntityService(), new MockBuildService()); } public ControllerTester(ManualClock clock) { - this(new AthenzDbMock(), clock, new ConfigServerClientMock(), + this(new AthenzDbMock(), clock, new ConfigServerMock(), new ZoneRegistryMock(), new GitHubMock(), new MockCuratorDb(), defaultRotationsConfig(), new MemoryNameService(), new ArtifactRepositoryMock(), new MemoryEntityService(), new MockBuildService()); } public ControllerTester(RotationsConfig rotationsConfig) { - this(new AthenzDbMock(), new ManualClock(), new ConfigServerClientMock(), + this(new AthenzDbMock(), new ManualClock(), new ConfigServerMock(), new ZoneRegistryMock(), new GitHubMock(), new MockCuratorDb(), rotationsConfig, new MemoryNameService(), new ArtifactRepositoryMock(), new MemoryEntityService(), new MockBuildService()); } public ControllerTester(MockCuratorDb curatorDb) { - this(new AthenzDbMock(), new ManualClock(), new ConfigServerClientMock(), + this(new AthenzDbMock(), new ManualClock(), new ConfigServerMock(), new ZoneRegistryMock(), new GitHubMock(), curatorDb, defaultRotationsConfig(), new MemoryNameService(), new ArtifactRepositoryMock(), new MemoryEntityService(), new MockBuildService()); } private ControllerTester(AthenzDbMock athenzDb, ManualClock clock, - ConfigServerClientMock configServer, ZoneRegistryMock zoneRegistry, + ConfigServerMock configServer, ZoneRegistryMock zoneRegistry, GitHubMock gitHub, CuratorDb curator, RotationsConfig rotationsConfig, MemoryNameService nameService, ArtifactRepositoryMock artifactRepository, EntityService entityService, MockBuildService buildService) { @@ -134,7 +134,7 @@ public final class ControllerTester { public ZoneRegistryMock zoneRegistry() { return zoneRegistry; } - public ConfigServerClientMock configServer() { return configServer; } + public ConfigServerMock configServer() { return configServer; } public GitHubMock gitHub() { return gitHub; } @@ -255,19 +255,19 @@ public final class ControllerTester { } private static Controller createController(CuratorDb curator, RotationsConfig rotationsConfig, - ConfigServerClientMock configServerClientMock, ManualClock clock, - GitHubMock gitHubClientMock, ZoneRegistryMock zoneRegistryMock, + ConfigServerMock configServer, ManualClock clock, + GitHubMock gitHub, ZoneRegistryMock zoneRegistryMock, AthenzDbMock athensDb, MemoryNameService nameService, ArtifactRepository artifactRepository, EntityService entityService, BuildService buildService) { Controller controller = new Controller(curator, rotationsConfig, - gitHubClientMock, + gitHub, entityService, new MockOrganization(clock), new MemoryGlobalRoutingService(), zoneRegistryMock, - configServerClientMock, + configServer, new NodeRepositoryClientMock(), new MockMetricsService(), nameService, diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java index ac1e5e7c677..d0e366663a1 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java @@ -9,7 +9,7 @@ import com.yahoo.test.ManualClock; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.ApplicationController; import com.yahoo.vespa.hosted.controller.ArtifactRepositoryMock; -import com.yahoo.vespa.hosted.controller.ConfigServerClientMock; +import com.yahoo.vespa.hosted.controller.ConfigServerMock; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.ControllerTester; import com.yahoo.vespa.hosted.controller.api.integration.BuildService; @@ -77,7 +77,7 @@ public class DeploymentTester { public ControllerTester controllerTester() { return tester; } - public ConfigServerClientMock configServer() { return tester.configServer(); } + public ConfigServerMock configServer() { return tester.configServer(); } public ArtifactRepositoryMock artifactRepository() { return tester.artifactRepository(); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerTester.java index 243cf7276bd..1bdb6eed0b2 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerTester.java @@ -10,7 +10,7 @@ import com.yahoo.container.http.filter.FilterChainRepository; import com.yahoo.io.IOUtils; import com.yahoo.jdisc.http.filter.SecurityRequestFilter; import com.yahoo.jdisc.http.filter.SecurityRequestFilterChain; -import com.yahoo.vespa.hosted.controller.ConfigServerClientMock; +import com.yahoo.vespa.hosted.controller.ConfigServerMock; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.versions.VersionStatus; import org.junit.ComparisonFailure; @@ -44,8 +44,8 @@ public class ContainerTester { return (Controller) container.components().getComponent(Controller.class.getName()); } - public ConfigServerClientMock configServer() { - return (ConfigServerClientMock) container.components().getComponent(ConfigServerClientMock.class.getName()); + public ConfigServerMock configServer() { + return (ConfigServerMock) container.components().getComponent(ConfigServerMock.class.getName()); } public void updateVersionStatus() { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ControllerContainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ControllerContainerTest.java index c51689c1a40..833e2d8b552 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ControllerContainerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ControllerContainerTest.java @@ -1,4 +1,4 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// 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.controller.restapi; import com.yahoo.application.Networking; @@ -69,7 +69,7 @@ public class ControllerContainerTest { " <component id='com.yahoo.vespa.hosted.controller.api.integration.stubs.LoggingDeploymentIssues'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.api.integration.stubs.DummyOwnershipIssues'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.api.integration.organization.MockOrganization'/>\n" + - " <component id='com.yahoo.vespa.hosted.controller.ConfigServerClientMock'/>\n" + + " <component id='com.yahoo.vespa.hosted.controller.ConfigServerMock'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.NodeRepositoryClientMock'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.ZoneRegistryMock'/>\n" + " <component id='com.yahoo.vespa.hosted.controller.Controller'/>\n" + diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java index 704e9fa1a07..fd4eb5c9ca1 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java @@ -18,7 +18,7 @@ import com.yahoo.vespa.athenz.api.AthenzUser; import com.yahoo.vespa.athenz.api.NToken; import com.yahoo.vespa.config.SlimeUtils; import com.yahoo.vespa.hosted.controller.Application; -import com.yahoo.vespa.hosted.controller.ConfigServerClientMock; +import com.yahoo.vespa.hosted.controller.ConfigServerMock; import com.yahoo.vespa.hosted.controller.api.identifiers.Property; import com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId; import com.yahoo.vespa.hosted.controller.api.identifiers.ScrewdriverId; @@ -612,7 +612,7 @@ public class ApplicationApiTest extends ControllerContainerTest { "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not create 'tenant1.application1': Application already exists\"}", 400); - ConfigServerClientMock configServer = (ConfigServerClientMock)container.components().getComponent("com.yahoo.vespa.hosted.controller.ConfigServerClientMock"); + ConfigServerMock configServer = (ConfigServerMock)container.components().getComponent("com.yahoo.vespa.hosted.controller.ConfigServerMock"); configServer.throwOnNextPrepare(new ConfigServerException(new URI("server-url"), "Failed to prepare application", ConfigServerException.ErrorCode.INVALID_APPLICATION_PACKAGE, null)); // POST (deploy) an application with an invalid application package |