diff options
author | bjormel <bjormel@yahooinc.com> | 2023-09-18 10:29:24 +0000 |
---|---|---|
committer | leandroalves <leandroalves@yahooinc.com> | 2023-09-20 09:08:56 +0200 |
commit | 09fa0d4a93c8e3d633705d5dc55f2f5d3f69b3c2 (patch) | |
tree | 5db84758a6704d34f19cd3c459dd64a69d32e9be | |
parent | 1067b50db94328d83ca0a185176225ee266aca72 (diff) |
Use getConfigServerVipUri, not getConfigServerYcpiUri
7 files changed, 9 insertions, 16 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java index 3b047e3fd28..2e247f60778 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java @@ -59,9 +59,7 @@ public interface ZoneRegistry { ZoneApi get(ZoneId zoneId); /** Returns the URI for the config server VIP in the given zone */ - URI getConfigServerVipUri(ZoneId zoneId); - - URI getConfigServerYcpiUri(ZoneId zoneId); + URI getConfigServerVipUri(ZoneId zoneId, boolean publiclyReachable); /** Returns the VIP hostname for the shared routing layer in given zone, if any */ Optional<String> getVipHostname(ZoneId zoneId); diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/FlagsTarget.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/FlagsTarget.java index f9b76f342af..7a84aecff5b 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/FlagsTarget.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/FlagsTarget.java @@ -70,8 +70,7 @@ public interface FlagsTarget { return new ConfigServerFlagsTarget(registry.system(), zone.getCloudName(), zone.getVirtualId(), - zone.getCloudName().equals(CloudName.YAHOO) ? registry.getConfigServerYcpiUri(zone.getVirtualId()) - : registry.getConfigServerVipUri(zone.getVirtualId()), + registry.getConfigServerVipUri(zone.getVirtualId(), zone.getCloudName().equals(CloudName.AWS)), registry.getConfigServerHttpsIdentity(zone.getVirtualId())); } diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/SystemFlagsDataArchiveTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/SystemFlagsDataArchiveTest.java index 759f21579d4..5de2a59ba29 100644 --- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/SystemFlagsDataArchiveTest.java +++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/SystemFlagsDataArchiveTest.java @@ -407,7 +407,7 @@ public class SystemFlagsDataArchiveTest { when(zoneApi.getCloudName()).thenReturn(CloudName.YAHOO); when(zoneApi.getVirtualId()).thenReturn(ZoneId.ofVirtualControllerZone()); when(registryMock.systemZone()).thenReturn(zoneApi); - when(registryMock.getConfigServerVipUri(any())).thenReturn(URI.create("http://localhost:8080/")); + when(registryMock.getConfigServerVipUri(any(), false)).thenReturn(URI.create("http://localhost:8080/")); when(registryMock.getConfigServerHttpsIdentity(any())).thenReturn(new AthenzService("domain", "servicename")); ZoneList zones = mockZoneList("prod.us-west-1", "prod.us-east-3"); when(registryMock.zones()).thenReturn(zones); 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 a2611fe3f9d..c4f0800a8f1 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 @@ -4,6 +4,8 @@ package com.yahoo.vespa.hosted.controller.proxy; import ai.vespa.util.http.hc4.SslConnectionSocketFactory; import com.yahoo.component.AbstractComponent; import com.yahoo.component.annotation.Inject; +import com.yahoo.config.provision.CloudName; +import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.jdisc.http.HttpRequest.Method; import com.yahoo.text.Text; import com.yahoo.vespa.athenz.api.AthenzIdentity; @@ -277,7 +279,7 @@ public class ConfigServerRestExecutorImpl extends AbstractComponent implements C public ConnectionReuseStrategy(ZoneRegistry zoneRegistry) { this(zoneRegistry.zones().all().ids().stream() - .map(zoneRegistry::getConfigServerVipUri) + .map((ZoneId zoneId) -> zoneRegistry.getConfigServerVipUri(zoneId, zoneRegistry.systemZone().getCloudName().equals(CloudName.AWS))) .map(URI::getHost) .collect(Collectors.toUnmodifiableSet())); } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandler.java index 1bcc99b9612..14223b49abc 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandler.java @@ -123,7 +123,7 @@ public class ConfigServerApiHandler extends AuditLoggingRequestHandler { private URI getEndpoint(ZoneId zoneId) { if (controllerZone.equals(zoneId)) return CONTROLLER_URI; - return controllerCloud.equals(CloudName.AWS) ? zoneRegistry.getConfigServerYcpiUri(zoneId) : zoneRegistry.getConfigServerVipUri(zoneId); + return zoneRegistry.getConfigServerVipUri(zoneId, controllerCloud.equals(CloudName.AWS)); } } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java index be7d86dd535..89a2067837b 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java @@ -101,8 +101,7 @@ public class ZoneApiHandler extends AuditLoggingRequestHandler { } private ProxyRequest proxyRequest(ZoneId zoneId, HttpURL.Path path, HttpRequest request) { - return ProxyRequest.tryOne(zoneRegistry.systemZone().getCloudName().equals(CloudName.AWS) ? zoneRegistry.getConfigServerYcpiUri(zoneId) - : zoneRegistry.getConfigServerVipUri(zoneId), + return ProxyRequest.tryOne(zoneRegistry.getConfigServerVipUri(zoneId, zoneRegistry.systemZone().getCloudName().equals(CloudName.AWS)), path, request); } 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 259c4e9deea..4c6ea791dc0 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 @@ -277,16 +277,11 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry } @Override - public URI getConfigServerVipUri(ZoneId zoneId) { + public URI getConfigServerVipUri(ZoneId zoneId, boolean publiclyReachable) { return URI.create(Text.format("https://cfg.%s.test.vip:4443/", zoneId.value())); } @Override - public URI getConfigServerYcpiUri(ZoneId zoneId) { - return URI.create(Text.format("https://cfg-%s.test.vip:4443/", zoneId.value().replace(".", "-"))); - } - - @Override public Optional<String> getVipHostname(ZoneId zoneId) { if (routingMethod(zoneId).isShared()) { return Optional.of("vip." + zoneId.value()); |