diff options
author | Martin Polden <mpolden@mpolden.no> | 2020-01-24 09:42:51 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2020-01-24 09:46:57 +0100 |
commit | 2acdd6878cd8a67d4ce10a22661c3356503c2827 (patch) | |
tree | 42149e6385273488d292dd0d3802fc9c383da2e4 | |
parent | 963e50d08a81dcc9d4b5fe5293a62e5156465f11 (diff) |
Support setting changing zone status in ConfigServer
2 files changed, 29 insertions, 4 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java index 77919b0ae54..ed83c83a1a2 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java @@ -67,14 +67,16 @@ public interface ConfigServer { * deployment in the shared routing layer * @param status The new status */ - // TODO(mpolden): Implement a zone-variant of this void setGlobalRotationStatus(DeploymentId deployment, String upstreamName, EndpointStatus status); /** - * Get the endpoint status for an app in one zone + * Set the new status for an entire zone. * - * @param deployment The application/zone pair - * @param endpoint The endpoint to modify + * @param zone the zone + * @param in whether to set zone status to 'in' or 'out' + */ + void setGlobalRotationStatus(ZoneId zone, boolean in); + /** * Get the endpoint status for an app in one zone. * @@ -85,6 +87,14 @@ public interface ConfigServer { */ EndpointStatus getGlobalRotationStatus(DeploymentId deployment, String upstreamName); + /** + * Get the status for an entire zone. + * + * @param zone the zone + * @return whether the zone status is 'in' + */ + boolean getGlobalRotationStatus(ZoneId zone); + /** The node repository on this config server */ NodeRepository nodeRepository(); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java index a4d56af5244..23102386e92 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java @@ -62,6 +62,7 @@ import static com.yahoo.config.provision.NodeResources.StorageType.remote; public class ConfigServerMock extends AbstractComponent implements ConfigServer { private final Map<DeploymentId, Application> applications = new LinkedHashMap<>(); + private final Set<ZoneId> inactiveZones = new HashSet<>(); private final Map<String, EndpointStatus> endpoints = new HashMap<>(); private final NodeRepositoryMock nodeRepository = new NodeRepositoryMock(); private final Map<DeploymentId, ServiceConvergence> serviceStatus = new HashMap<>(); @@ -412,12 +413,26 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer } @Override + public void setGlobalRotationStatus(ZoneId zone, boolean in) { + if (in) { + inactiveZones.remove(zone); + } else { + inactiveZones.add(zone); + } + } + + @Override public EndpointStatus getGlobalRotationStatus(DeploymentId deployment, String endpoint) { EndpointStatus result = new EndpointStatus(EndpointStatus.Status.in, "", "", 1497618757L); return endpoints.getOrDefault(endpoint, result); } @Override + public boolean getGlobalRotationStatus(ZoneId zone) { + return !inactiveZones.contains(zone); + } + + @Override public InputStream getLogs(DeploymentId deployment, Map<String, String> queryParameters) { return new ByteArrayInputStream(log.getBytes(StandardCharsets.UTF_8)); } |