diff options
author | Martin Polden <mpolden@mpolden.no> | 2020-01-28 16:00:00 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2020-01-28 16:00:00 +0100 |
commit | dd9a0a62f48d87c67229bce935a3b61329d7ecfe (patch) | |
tree | 243970689c60f507a1d314bd759aa4aa713cf253 /controller-server | |
parent | 1e9a6becfdcae3c2dd423184165b971fc3683260 (diff) |
Allow status change in zones that are exclusively directly routed
Diffstat (limited to 'controller-server')
4 files changed, 21 insertions, 16 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java index d7747fa1b6f..f28c877dce6 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java @@ -251,7 +251,6 @@ public class ApplicationController { /** Change status of all global endpoints for given deployment */ public void setGlobalRotationStatus(DeploymentId deployment, EndpointStatus status) { var globalEndpoints = findGlobalEndpoints(deployment); - if (globalEndpoints.isEmpty()) throw new IllegalArgumentException(deployment + " has no global endpoints"); globalEndpoints.forEach(endpoint -> { try { configServer.setGlobalRotationStatus(deployment, endpoint.upstreamName(), status); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java index 160fdfa9e5b..83f80488ee5 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java @@ -210,17 +210,6 @@ public class ControllerTest { assertEquals(2, upstreamOneEndpoints.get().size()); assertTrue("All upstreams are out", upstreamOneEndpoints.get().stream().allMatch(es -> es.getStatus() == EndpointStatus.Status.out)); assertTrue("Reason is set", upstreamOneEndpoints.get().stream().allMatch(es -> es.getReason().equals("unit-test"))); - - // Deployment without a global endpoint - tester.serviceRegistry().routingGeneratorMock().putEndpoints(deployment, List.of( - new RoutingEndpoint("http://old-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream2"), - new RoutingEndpoint("http://qrs-endpoint.vespa.yahooapis.com:4080", "host1", false, "upstream1"), - new RoutingEndpoint("http://feeding-endpoint.vespa.yahooapis.com:4080", "host2", false, "upstream3") - )); - try { - tester.controller().applications().setGlobalRotationStatus(deployment, status); - fail("Expected exception"); - } catch (IllegalArgumentException ignored) {} } @Test diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/routing/RoutingApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/routing/RoutingApiTest.java index af237dbdb6c..e5670139b0f 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/routing/RoutingApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/routing/RoutingApiTest.java @@ -46,6 +46,7 @@ public class RoutingApiTest extends ControllerContainerTest { var applicationPackage = new ApplicationPackageBuilder() .region(westZone.region()) .region(eastZone.region()) + .endpoint("default", "default", eastZone.region().value(), westZone.region().value()) .build(); context.submit(applicationPackage).deploy(); context.addRoutingPolicy(westZone, true); @@ -103,7 +104,7 @@ public class RoutingApiTest extends ControllerContainerTest { var applicationPackage = new ApplicationPackageBuilder() .region(westZone.region()) .region(eastZone.region()) - .endpoint("default", "qrs", eastZone.region().value(), westZone.region().value()) + .endpoint("default", "default", eastZone.region().value(), westZone.region().value()) .build(); context.submit(applicationPackage).deploy(); @@ -150,11 +151,27 @@ public class RoutingApiTest extends ControllerContainerTest { tester.assertResponse(operatorRequest("http://localhost:8080/routing/v1/status/environment/prod/region/us-west-1", "", Request.Method.GET), new File("rotation/zone-status-in.json")); + } + + // TODO(mpolden): Remove this once a zone supports either of routing policy and rotation + @Test + public void mixed_routing() { + // Deploy application + var context = deploymentTester.newDeploymentContext(); + var westZone = ZoneId.from("prod", "us-west-1"); + var eastZone = ZoneId.from("prod", "us-east-3"); + var applicationPackage = new ApplicationPackageBuilder() + .region(westZone.region()) + .region(eastZone.region()) + .endpoint("default", "default", eastZone.region().value(), westZone.region().value()) + .build(); + context.submit(applicationPackage).deploy(); - // TODO(mpolden): Remove the following once a zone supports either of routing policy and rotation + // Assign policy in one zone + deploymentTester.controllerTester().zoneRegistry().setDirectlyRouted(ZoneApiMock.from(westZone)); + context.addRoutingPolicy(westZone, true); // GET status with both policy and rotation assigned - context.addRoutingPolicy(westZone, true); tester.assertResponse(operatorRequest("http://localhost:8080/routing/v1/status/tenant/tenant/application/application/instance/default/environment/prod/region/us-west-1", "", Request.Method.GET), new File("multi-status-initial.json")); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/routing/responses/multi-status-initial.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/routing/responses/multi-status-initial.json index a15a0cc8a99..cdf3e093f97 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/routing/responses/multi-status-initial.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/routing/responses/multi-status-initial.json @@ -6,7 +6,7 @@ "environment": "prod", "region": "us-west-1", "status": "in", - "agent": "operator", + "agent": "unknown", "changedAt": "(ignore)" }, { |