diff options
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java | 9 | ||||
-rw-r--r-- | controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java | 11 |
2 files changed, 18 insertions, 2 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 e32945064fe..5f2c187c9a6 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 @@ -289,11 +289,18 @@ public class RoutingController { var endpoints = new ArrayList<Endpoint>(); var directMethods = 0; var zones = deployments.stream().map(DeploymentId::zoneId).collect(Collectors.toList()); - for (var method : routingMethodsOfAll(deployments, application)) { + var availableRoutingMethods = routingMethodsOfAll(deployments, application); + + // Hide global shared endpoints if at least one direct method is supported + // and instances referenced by the global endpoint is configured to be hidden + var hideSharedEndpoints = availableRoutingMethods.stream().anyMatch(RoutingMethod::isDirect) + && hideSharedRoutingEndpoint.with(FetchVector.Dimension.APPLICATION_ID, routingId.application().serializedForm()).value(); + for (var method : availableRoutingMethods) { if (method.isDirect() && ++directMethods > 1) { throw new IllegalArgumentException("Invalid routing methods for " + routingId + ": Exceeded maximum " + "direct methods"); } + if (hideSharedEndpoints && !method.isDirect()) continue; endpoints.add(Endpoint.of(routingId.application()) .target(routingId.endpointId(), cluster, zones) .on(Port.fromRoutingMethod(method)) 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 407256b19c8..daf010b861a 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 @@ -48,7 +48,6 @@ import java.time.Duration; import java.time.Instant; import java.util.Collection; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.function.Function; @@ -968,6 +967,16 @@ public class ControllerTest { .athenzIdentity(AthenzDomain.from("domain"), AthenzService.from("service")) .build()).deploy(); assertEquals(Set.of(RoutingMethod.sharedLayer4), routingMethods.get()); + + // Global endpoint is added and includes directly routed endpoint name + applicationPackageBuilder = applicationPackageBuilder.endpoint("default", "default"); + context.submit(applicationPackageBuilder.build()).deploy(); + for (var zone : List.of(zone1, zone2)) { + assertEquals(Set.of("rotation-id-01", + "application.tenant.global.vespa.oath.cloud"), + tester.configServer().rotationNames().get(context.deploymentIdIn(zone))); + } + } @Test |