From 0f5f50f33c0d8e7caad7d49c66eb62e3feb6521e Mon Sep 17 00:00:00 2001 From: Frode Lundgren Date: Fri, 28 Sep 2018 12:54:10 +0200 Subject: Revert "Revert "Adding getConfigServerApiUris() to include both cfg servers and VIP [VESPA-12701]"" --- .../restapi/application/ApplicationApiHandler.java | 4 ++-- .../hosted/controller/integration/ConfigServerMock.java | 8 ++++++-- .../hosted/controller/integration/ZoneRegistryMock.java | 13 +++++++++++-- .../controller/restapi/application/responses/services.json | 4 ++-- 4 files changed, 21 insertions(+), 8 deletions(-) (limited to 'controller-server') 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 57133986654..da073308ae8 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 @@ -640,7 +640,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.zoneRegistry().getConfigServerUris(ZoneId.from(environment, region)), + controller.zoneRegistry().getConfigServerApiUris(ZoneId.from(environment, region)), request.getUri()); response.setResponse(applicationView); return response; @@ -650,7 +650,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.zoneRegistry().getConfigServerUris(ZoneId.from(environment, region)), + controller.zoneRegistry().getConfigServerApiUris(ZoneId.from(environment, region)), request.getUri()); response.setResponse(result, serviceName, restPath); return response; diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java index e29ffd824cd..af78499726a 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java @@ -252,17 +252,21 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer @Override public ApplicationView getApplicationView(String tenantName, String applicationName, String instanceName, String environment, String region) { + String cfgHostname = String.format("https://cfg.%s.%s.test.vip:4443", environment, region); + String cfgServiceUrlPrefix = String.format("%s/serviceview/v1/tenant/%s/application/%s/environment/%s/region/%s/instance/%s/service", + cfgHostname, tenantName, applicationName, + environment, region, instanceName); ApplicationView applicationView = new ApplicationView(); ClusterView cluster = new ClusterView(); cluster.name = "cluster1"; cluster.type = "content"; - cluster.url = "http://localhost:8080/application/v4/tenant/tenant1/application/application1/environment/prod/region/us-west-1/instance/default/service/container-clustercontroller-6s8slgtps7ry8uh6lx21ejjiv/cluster/v2/cluster1"; + cluster.url = cfgServiceUrlPrefix + "/container-clustercontroller-6s8slgtps7ry8uh6lx21ejjiv/cluster/v2/cluster1"; ServiceView service = new ServiceView(); service.configId = "cluster1/storage/0"; service.host = "host1"; service.serviceName = "storagenode"; service.serviceType = "storagenode"; - service.url = "http://localhost:8080/application/v4/tenant/tenant1/application/application1/environment/prod/region/us-west-1/instance/default/service/storagenode-awe3slno6mmq2fye191y324jl/state/v1/"; + service.url = cfgServiceUrlPrefix + "/storagenode-awe3slno6mmq2fye191y324jl/state/v1/"; cluster.services = new ArrayList<>(); cluster.services.add(service); applicationView.clusters = 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 cb6d971c2d9..ad6c26322da 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 @@ -117,12 +117,21 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry @Override public List getConfigServerUris(ZoneId zoneId) { - return Collections.singletonList(URI.create(String.format("https://cfg.%s.test:4443", zoneId.value()))); + return Collections.singletonList(URI.create(String.format("https://cfg.%s.test:4443/", zoneId.value()))); } @Override public Optional getConfigServerVipUri(ZoneId zoneId) { - return Optional.of(URI.create(String.format("https://cfg.%s.test:4443", zoneId.value()))); + return Optional.of(URI.create(String.format("https://cfg.%s.test.vip:4443/", zoneId.value()))); + } + + @Override + public List getConfigServerApiUris(ZoneId zoneId) { + List uris = new ArrayList(); + uris.add(URI.create(String.format("https://cfg.%s.test:4443/", zoneId.value()))); + uris.add(URI.create(String.format("https://cfg.%s.test.vip:4443/", zoneId.value()))); + + return uris; } @Override diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/services.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/services.json index 8a0849393c9..c68b7dc9e87 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/services.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/services.json @@ -3,10 +3,10 @@ { "name": "cluster1", "type": "content", - "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/environment/prod/region/us-west-1/instance/default/service/container-clustercontroller-6s8slgtps7ry8uh6lx21ejjiv/cluster/v2/cluster1", + "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/environment/prod/region/corp-us-east-1/instance/default/service/container-clustercontroller-6s8slgtps7ry8uh6lx21ejjiv/cluster/v2/cluster1", "services": [ { - "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/environment/prod/region/us-west-1/instance/default/service/storagenode-awe3slno6mmq2fye191y324jl/state/v1/", + "url": "http://localhost:8080/application/v4/tenant/tenant1/application/application1/environment/prod/region/corp-us-east-1/instance/default/service/storagenode-awe3slno6mmq2fye191y324jl/state/v1/", "serviceType": "storagenode", "serviceName": "storagenode", "configId": "cluster1/storage/0", -- cgit v1.2.3