summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorFrode Lundgren <frodelu@frode.lu>2018-09-28 12:54:10 +0200
committerFrode Lundgren <frodelu@yahoo-inc.com>2018-10-23 11:47:17 +0200
commit0f5f50f33c0d8e7caad7d49c66eb62e3feb6521e (patch)
tree4d0640923285758318ef678711da484e47dc38b6 /controller-server
parent123c5a40b52018090a9a7d36ab2699b85bd12328 (diff)
Revert "Revert "Adding getConfigServerApiUris() to include both cfg servers and VIP [VESPA-12701]""
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java8
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java13
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/services.json4
4 files changed, 21 insertions, 8 deletions
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<URI> 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<URI> 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<URI> getConfigServerApiUris(ZoneId zoneId) {
+ List<URI> uris = new ArrayList<URI>();
+ 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",