From 08a1bc42a544f5d6193850f95137b9f21d41c16a Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Mon, 8 Nov 2021 15:06:05 +0100 Subject: Add scope to container endpoint --- .../com/yahoo/vespa/hosted/controller/RoutingController.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'controller-server') 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 6afee557029..ffaa0f2cb53 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 @@ -277,6 +277,7 @@ public class RoutingController { // Include rotation ID as a valid name of this container endpoint (required by global routing health checks) names.add(assignedRotation.rotationId().asString()); containerEndpoints.add(new ContainerEndpoint(assignedRotation.clusterId().value(), + asString(Endpoint.Scope.global), names)); } // Add endpoints not backed by a rotation (i.e. other routing methods so that the config server always knows @@ -287,6 +288,7 @@ public class RoutingController { .groupingBy(Endpoint::cluster) .forEach((clusterId, clusterEndpoints) -> { containerEndpoints.add(new ContainerEndpoint(clusterId.value(), + asString(Endpoint.Scope.global), clusterEndpoints.mapToList(Endpoint::dnsName))); }); return Collections.unmodifiableSet(containerEndpoints); @@ -411,5 +413,14 @@ public class RoutingController { return endpoints; } + private static String asString(Endpoint.Scope scope) { + switch (scope) { + case application: return "application"; + case global: return "global"; + case weighted: return "weighted"; + case zone: return "zone"; + } + throw new IllegalArgumentException("Unknown scope " + scope); + } } -- cgit v1.2.3