diff options
author | Martin Polden <mpolden@mpolden.no> | 2018-03-14 12:51:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-14 12:51:29 +0100 |
commit | c5338b87600793bce76c9bbc0437545e4d219be5 (patch) | |
tree | 2d11663b7ad92023e2ac7f724adff5bf25e55e65 /controller-server | |
parent | 5adc38666f5e9e55622bbb3c23bfea559d299b05 (diff) | |
parent | 26e1e1723f3796b4e9afd3fce10ea4f756a08550 (diff) |
Merge pull request #5328 from vespa-engine/mpolden/zone-registry-cleanup
Zone registry cleanup
Diffstat (limited to 'controller-server')
6 files changed, 13 insertions, 25 deletions
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 303f5d5484b..f6c6d2c10db 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 @@ -24,7 +24,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.organization.Organizati import com.yahoo.vespa.hosted.controller.api.integration.routing.GlobalRoutingService; import com.yahoo.vespa.hosted.controller.api.integration.routing.RotationStatus; import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator; -import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry; import com.yahoo.vespa.hosted.controller.persistence.ControllerDb; import com.yahoo.vespa.hosted.controller.persistence.CuratorDb; @@ -33,7 +32,6 @@ import com.yahoo.vespa.hosted.controller.versions.VespaVersion; import com.yahoo.vespa.hosted.rotation.config.RotationsConfig; import com.yahoo.vespa.serviceview.bindings.ApplicationView; -import java.net.URI; import java.time.Clock; import java.util.LinkedHashMap; import java.util.List; @@ -162,15 +160,6 @@ public class Controller extends AbstractComponent { public Clock clock() { return clock; } - public Optional<URI> getLogServerUrl(DeploymentId deploymentId) { - return zoneRegistry.getLogServerUri(deploymentId); - } - - // TODO Rename to getConfigServerUris once port 4080 is removed from configservers - public List<URI> getSecureConfigServerUris(ZoneId zoneId) { - return zoneRegistry.getConfigServerSecureUris(zoneId); - } - public ZoneRegistry zoneRegistry() { return zoneRegistry; } public Map<String, RotationStatus> getHealthStatus(String hostname) { diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java index 99b738a6a38..06dc29b3b70 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java @@ -80,7 +80,7 @@ public class ConfigServerRestExecutorImpl implements ConfigServerRestExecutor { ZoneId zoneId = ZoneId.from(proxyRequest.getEnvironment(), proxyRequest.getRegion()); // Make a local copy of the list as we want to manipulate it in case of ping problems. - List<URI> allServers = new ArrayList<>(zoneRegistry.getConfigServerSecureUris(zoneId)); + List<URI> allServers = new ArrayList<>(zoneRegistry.getConfigServerUris(zoneId)); StringBuilder errorBuilder = new StringBuilder(); if (queueFirstServerIfDown(allServers, proxyRequest)) { @@ -263,7 +263,7 @@ public class ConfigServerRestExecutorImpl implements ConfigServerRestExecutor { AthenzIdentityVerifier hostnameVerifier = new AthenzIdentityVerifier( singleton( - zoneRegistry.getConfigserverAthenzService( + zoneRegistry.getConfigServerAthenzService( ZoneId.from(proxyRequest.getEnvironment(), proxyRequest.getRegion())))); return HttpClientBuilder.create() .setUserAgent("config-server-proxy-client") diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java index 1c2236a6791..337ad934d41 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java @@ -460,7 +460,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { response.setString("nodes", withPath("/zone/v2/" + deploymentId.zoneId().environment() + "/" + deploymentId.zoneId().region() + "/nodes/v2/node/?&recursive=true&application=" + deploymentId.applicationId().tenant() + "." + deploymentId.applicationId().application() + "." + deploymentId.applicationId().instance(), request.getUri()).toString()); - controller.getLogServerUrl(deploymentId) + controller.zoneRegistry().getLogServerUri(deploymentId) .ifPresent(elkUrl -> response.setString("elkUrl", elkUrl.toString())); response.setString("yamasUrl", monitoringSystemUri(deploymentId).toString()); @@ -591,7 +591,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { ApplicationView applicationView = controller.getApplicationView(tenantName, applicationName, instanceName, environment, region); ServiceApiResponse response = new ServiceApiResponse(ZoneId.from(environment, region), new ApplicationId.Builder().tenant(tenantName).applicationName(applicationName).instanceName(instanceName).build(), - controller.getSecureConfigServerUris(ZoneId.from(environment, region)), + controller.zoneRegistry().getConfigServerUris(ZoneId.from(environment, region)), request.getUri()); response.setResponse(applicationView); return response; @@ -601,7 +601,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { Map<?,?> result = controller.getServiceApiResponse(tenantName, applicationName, instanceName, environment, region, serviceName, restPath); ServiceApiResponse response = new ServiceApiResponse(ZoneId.from(environment, region), new ApplicationId.Builder().tenant(tenantName).applicationName(applicationName).instanceName(instanceName).build(), - controller.getSecureConfigServerUris(ZoneId.from(environment, region)), + controller.zoneRegistry().getConfigServerUris(ZoneId.from(environment, region)), request.getUri()); response.setResponse(result, serviceName, restPath); return response; 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 d628489bc29..eb932d42e79 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 @@ -119,7 +119,7 @@ public class VersionStatus { List<URI> configServers = controller.zoneRegistry().zones() .controllerManaged() .ids().stream() - .flatMap(zoneId -> controller.getSecureConfigServerUris(zoneId).stream()) + .flatMap(zoneId -> controller.zoneRegistry().getConfigServerUris(zoneId).stream()) .collect(Collectors.toList()); ListMap<Version, String> versions = new ListMap<>(); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java index 63751cfaa98..d7504edb342 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java @@ -76,7 +76,7 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry return ZoneFilterMock.from(Collections.unmodifiableList(zones)); } - public AthenzService getConfigserverAthenzService(ZoneId zone) { + public AthenzService getConfigServerAthenzService(ZoneId zone) { return new AthenzService("vespadomain", "provider-" + zone.environment().value() + "-" + zone.region().value()); } @@ -86,7 +86,7 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry } @Override - public List<URI> getConfigServerSecureUris(ZoneId zoneId) { + public List<URI> getConfigServerUris(ZoneId zoneId) { return Collections.singletonList(URI.create(String.format("https://cfg.%s.test:4443", zoneId.value()))); } @@ -125,9 +125,4 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry + deploymentId.zoneId().region().value() + "&application=" + deploymentId.applicationId().toShortString()); } - @Override - public URI getDashboardUri() { - return URI.create("http://dashboard.test"); - } - } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java index 7b0ca7cb618..4d3f26d247e 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java @@ -21,6 +21,8 @@ import org.junit.Test; import org.mockito.Mockito; import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; import java.time.Clock; import java.time.Instant; import java.time.ZoneId; @@ -40,6 +42,8 @@ import static org.mockito.Mockito.when; */ public class MetricsReporterTest { + private static final Path testData = Paths.get("src/test/resources/"); + @Test public void test_chef_metrics() throws IOException { ControllerTester tester = new ControllerTester(); @@ -108,7 +112,7 @@ public class MetricsReporterTest { Chef client = Mockito.mock(Chef.class); PartialNodeResult result = new ObjectMapper() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) - .readValue(getClass().getClassLoader().getResource("chef_output.json"), PartialNodeResult.class); + .readValue(testData.resolve("chef_output.json").toFile(), PartialNodeResult.class); when(client.partialSearchNodes(anyString(), anyListOf(AttributeMapping.class))).thenReturn(result); Clock clock = Clock.fixed(Instant.ofEpochSecond(1475497913), ZoneId.systemDefault()); |