diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2019-10-24 15:19:41 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2019-10-24 15:19:41 +0200 |
commit | bbaeb599e433f0d3cb41621d2ec6c324183ce707 (patch) | |
tree | 1e9c35994c73ab844cb8583881adbe658f98e06e /controller-server/src | |
parent | 090545c72987caae213384f7dbdcbc95016b39e3 (diff) |
Change return type of 'getConfigServerVipUri' to 'URI'
Configservers in all zones are behind a VIP/load balancer.
Diffstat (limited to 'controller-server/src')
2 files changed, 13 insertions, 9 deletions
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 a4ca8605f4b..72b11f56d9f 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 @@ -79,13 +79,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 = zoneRegistry.getConfigServerVipUri(zoneId) - // TODO: Use config server VIP for all zones that have one - .filter(zone -> zoneId.region().value().startsWith("aws-") || zoneId.region().value().contains("-aws-")) - - .map(Collections::singletonList) - .orElseGet(() -> new ArrayList<>(zoneRegistry.getConfigServerUris(zoneId))); + List<URI> allServers = getConfigserverEndpoints(zoneId); StringBuilder errorBuilder = new StringBuilder(); if (queueFirstServerIfDown(allServers, proxyRequest)) { @@ -102,6 +96,16 @@ public class ConfigServerRestExecutorImpl implements ConfigServerRestExecutor { + errorBuilder.toString())); } + private List<URI> getConfigserverEndpoints(ZoneId zoneId) { + // TODO: Use config server VIP for all zones that have one + // Make a local copy of the list as we want to manipulate it in case of ping problems. + if (zoneId.region().value().startsWith("aws-") || zoneId.region().value().contains("-aws-")) { + return Collections.singletonList(zoneRegistry.getConfigServerVipUri(zoneId)); + } else { + return new ArrayList<>(zoneRegistry.getConfigServerUris(zoneId)); + } + } + private static class DiscoveryResponseStructure { public List<String> uris = new ArrayList<>(); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java index 7771dd2d1a0..5c13ae62c90 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java @@ -175,8 +175,8 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry } @Override - public Optional<URI> getConfigServerVipUri(ZoneId zoneId) { - return Optional.of(URI.create(String.format("https://cfg.%s.test.vip:4443/", zoneId.value()))); + public URI getConfigServerVipUri(ZoneId zoneId) { + return URI.create(String.format("https://cfg.%s.test.vip:4443/", zoneId.value())); } @Override |