diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-03-24 15:40:03 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2021-03-25 08:51:13 +0100 |
commit | 0a39831d23f0d79b7dba37ea1c8207f9d9da9483 (patch) | |
tree | 6cd9a81813ef7f71475d81359d1273baa567aad6 /controller-server | |
parent | c04a2be61d1ac6c00e5365255479dc9d12c49a81 (diff) |
Send container endpoints on deployment for all routing methods
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java | 8 | ||||
-rw-r--r-- | controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java | 39 |
2 files changed, 46 insertions, 1 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java index 7f7b8452579..c7cc0f361bc 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java @@ -225,6 +225,14 @@ public class RoutingController { names.add(assignedRotation.rotationId().asString()); containerEndpoints.add(new ContainerEndpoint(assignedRotation.clusterId().value(), names)); } + // Add endpoints not backed by a rotation + endpoints.not().requiresRotation() + .targets(zone) + .groupingBy(Endpoint::cluster) + .forEach((clusterId, clusterEndpoints) -> { + containerEndpoints.add(new ContainerEndpoint(clusterId.value(), + clusterEndpoints.mapToList(Endpoint::dnsName))); + }); return Collections.unmodifiableSet(containerEndpoints); } 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 dc2119f2cc9..0c0d1d80adb 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 @@ -37,6 +37,7 @@ import com.yahoo.vespa.hosted.controller.integration.ZoneApiMock; import com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb; import com.yahoo.vespa.hosted.controller.rotation.RotationId; import com.yahoo.vespa.hosted.controller.rotation.RotationLock; +import com.yahoo.vespa.hosted.rotation.config.RotationsConfig; import org.junit.Test; import java.time.Duration; @@ -818,7 +819,43 @@ public class ControllerTest { } @Test - public void testDirectRoutingSupport() { + public void testDeploymentDirectRouting() { + // Rotation-less system + DeploymentTester tester = new DeploymentTester(new ControllerTester(new RotationsConfig.Builder().build())); + var context = tester.newDeploymentContext(); + var zone1 = ZoneId.from("prod", "us-west-1"); + var zone2 = ZoneId.from("prod", "us-east-3"); + var zone3 = ZoneId.from("prod", "eu-west-1"); + tester.controllerTester().zoneRegistry() + .exclusiveRoutingIn(ZoneApiMock.from(zone1), ZoneApiMock.from(zone2), ZoneApiMock.from(zone3)); + + var applicationPackageBuilder = new ApplicationPackageBuilder() + .region(zone1.region()) + .region(zone2.region()) + .region(zone3.region()) + .endpoint("default", "default") + .endpoint("foo", "qrs") + .endpoint("us", "default", zone1.region().value(), zone2.region().value()) + .athenzIdentity(AthenzDomain.from("domain"), AthenzService.from("service")) + .compileVersion(RoutingController.DIRECT_ROUTING_MIN_VERSION); + context.submit(applicationPackageBuilder.build()).deploy(); + + // Deployment passes container endpoints to config server + for (var zone : List.of(zone1, zone2)) { + assertEquals("Expected container endpoints in " + zone, + Set.of("application.tenant.global.vespa.oath.cloud", + "foo.application.tenant.global.vespa.oath.cloud", + "us.application.tenant.global.vespa.oath.cloud"), + tester.configServer().containerEndpoints().get(context.deploymentIdIn(zone))); + } + assertEquals("Expected container endpoints in " + zone3, + Set.of("application.tenant.global.vespa.oath.cloud", + "foo.application.tenant.global.vespa.oath.cloud"), + tester.configServer().containerEndpoints().get(context.deploymentIdIn(zone3))); + } + + @Test + public void testDeploymentWithSharedAndDirectRouting() { var context = tester.newDeploymentContext(); var zone1 = ZoneId.from("prod", "us-west-1"); var zone2 = ZoneId.from("prod", "us-east-3"); |