diff options
author | Martin Polden <mpolden@mpolden.no> | 2020-10-30 11:16:54 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2020-10-30 11:16:54 +0100 |
commit | e24e347a4175c0de62deb321bf70abf2534ef699 (patch) | |
tree | 763d42a96df3820cec37dda14e72273d92e18c60 /controller-server | |
parent | 31a4d6d27336d335429b8a63ea949a1d2c074615 (diff) |
Skip status for routing policies not applying to a global endpoint
Diffstat (limited to 'controller-server')
2 files changed, 17 insertions, 0 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/routing/RoutingApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/routing/RoutingApiHandler.java index 114a2967e9a..ace176bd91e 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/routing/RoutingApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/routing/RoutingApiHandler.java @@ -265,6 +265,7 @@ public class RoutingApiHandler extends AuditLoggingRequestHandler { // Include status from routing policies var routingPolicies = controller.routing().policies().get(deploymentId); for (var policy : routingPolicies.values()) { + if (policy.endpoints().isEmpty()) continue; // This policy does not apply to a global endpoint if (!controller.zoneRegistry().routingMethods(policy.id().zone()).contains(RoutingMethod.exclusive)) continue; deploymentStatusToSlime(deploymentsArray.addObject(), new DeploymentId(policy.id().owner(), policy.id().zone()), 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 b0549662ab0..9bd8485db77 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 @@ -2,6 +2,7 @@ package com.yahoo.vespa.hosted.controller.restapi.routing; import com.yahoo.application.container.handler.Request; +import com.yahoo.config.application.api.ValidationId; import com.yahoo.config.provision.AthenzDomain; import com.yahoo.config.provision.AthenzService; import com.yahoo.config.provision.zone.RoutingMethod; @@ -184,6 +185,21 @@ 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("policy/zone-status-in.json")); + + // Endpoint is removed + applicationPackage = new ApplicationPackageBuilder() + .athenzIdentity(AthenzDomain.from("domain"), AthenzService.from("service")) + .compileVersion(RoutingController.DIRECT_ROUTING_MIN_VERSION) + .region(westZone.region()) + .region(eastZone.region()) + .allow(ValidationId.globalEndpointChange) + .build(); + context.submit(applicationPackage).deploy(); + + // GET deployment status. Now empty as no routing policies have global endpoints + tester.assertResponse(operatorRequest("http://localhost:8080/routing/v1/status/tenant/tenant/application/application/instance/default/environment/prod/region/us-west-1", + "", Request.Method.GET), + "{\"deployments\":[]}"); } @Test |