diff options
author | Martin Polden <mpolden@mpolden.no> | 2018-04-20 09:13:49 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2018-04-20 12:37:09 +0200 |
commit | 4e338e0634403ba143b7f29de2f8b4a7aa4e4bb2 (patch) | |
tree | 247aa08182de7cfcd2cc30367bf7ea4528b45afc /controller-api | |
parent | 27dba20caf391bf16bb6ff1c8fb9e2e9a5c9e472 (diff) |
Upgrade config servers in system
Diffstat (limited to 'controller-api')
4 files changed, 90 insertions, 6 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 44c6d899360..86ae71f747c 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 @@ -43,11 +43,14 @@ public interface ConfigServer { JsonNode waitForConfigConverge(DeploymentId applicationInstance, long timeoutInSeconds); ApplicationView getApplicationView(String tenantName, String applicationName, String instanceName, String environment, String region); - + Map<?,?> getServiceApiResponse(String tenantName, String applicationName, String instanceName, String environment, String region, String serviceName, String restPath); - - /** Returns the version this particular config server is running */ - Version version(URI configServerUri); + + /** Returns the version of this config server */ + ConfigServerVersion version(URI configServerUri); + + /** Upgrade config server at URI to the given version */ + void upgrade(URI configServerUri, Version version); /** * Set new status on en endpoint in one zone. diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServerVersion.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServerVersion.java new file mode 100644 index 00000000000..ca219d4e802 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServerVersion.java @@ -0,0 +1,32 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.integration.configserver; + +import com.yahoo.component.Version; + +/** + * Represents the config server's current and wanted version. + * + * @author mpolden + */ +public class ConfigServerVersion { + + private final Version current; + private final Version wanted; + + public ConfigServerVersion(Version current, Version wanted) { + this.current = current; + this.wanted = wanted; + } + + public Version current() { + return current; + } + + public Version wanted() { + return wanted; + } + + public boolean upgrading() { + return !current.equals(wanted); + } +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/UpgradePolicy.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/UpgradePolicy.java new file mode 100644 index 00000000000..96ff468d2d6 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/UpgradePolicy.java @@ -0,0 +1,46 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.integration.zone; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * This class declares the order to use when upgrading zones in a system. + * + * @author mpolden + */ +public class UpgradePolicy { + + private final List<List<ZoneId>> zones; + + private UpgradePolicy(List<List<ZoneId>> zones) { + this.zones = zones; + } + + public List<List<ZoneId>> asList() { + return Collections.unmodifiableList(zones); + } + + private UpgradePolicy with(ZoneId... zone) { + List<List<ZoneId>> zones = new ArrayList<>(this.zones); + zones.add(Arrays.asList(zone)); + return new UpgradePolicy(zones); + } + + /** Upgrade given zone as the next step */ + public UpgradePolicy upgrade(ZoneId zone) { + return with(zone); + } + + /** Upgrade given zones in parallel as the next step */ + public UpgradePolicy upgradeInParallel(ZoneId... zone) { + return with(zone); + } + + public static UpgradePolicy create() { + return new UpgradePolicy(Collections.emptyList()); + } + +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java index 169f38aaf4c..dea14493d26 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java @@ -1,4 +1,4 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.api.integration.zone; import com.yahoo.config.provision.Environment; @@ -28,7 +28,7 @@ public interface ZoneRegistry { /** Returns the default region for the given environment, if one is configured */ Optional<RegionName> getDefaultRegion(Environment environment); - /** Returns a list with all known config servers in the given zone, with a secure connection URL */ + /** Returns the API endpoints of all known config servers in the given zone */ List<URI> getConfigServerUris(ZoneId zoneId); /** Returns the URI for the config server VIP in the given zone, or Optional.empty() if no VIP exists */ @@ -49,4 +49,7 @@ public interface ZoneRegistry { /** Return the configserver's Athenz service identity */ AthenzService getConfigServerAthenzService(ZoneId zoneId); + /** Returns the upgrade policy to use for zones in this registry */ + UpgradePolicy upgradePolicy(); + } |