diff options
author | Martin Polden <mpolden@mpolden.no> | 2023-07-26 16:02:45 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2023-07-27 13:13:21 +0200 |
commit | abc51d778d3f370e04cf79d649db59cc3e596449 (patch) | |
tree | 250e669ec0a9dcc23ca2a5ce49b63b58d61e60ef /config-model-api/src/main/java/com/yahoo/config/application/api | |
parent | 34b04e11e2e75d929acf248693fb74a5e6350622 (diff) |
Remove global-service-id
Diffstat (limited to 'config-model-api/src/main/java/com/yahoo/config/application/api')
2 files changed, 4 insertions, 32 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentInstanceSpec.java b/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentInstanceSpec.java index b6f934c8824..4ca96453ad1 100644 --- a/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentInstanceSpec.java +++ b/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentInstanceSpec.java @@ -1,7 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config.application.api; -import ai.vespa.validation.Validation; import com.yahoo.config.provision.AthenzService; import com.yahoo.config.provision.CloudAccount; import com.yahoo.config.provision.CloudName; @@ -58,7 +57,6 @@ public class DeploymentInstanceSpec extends DeploymentSpec.Steps { private final int maxRisk; private final int maxIdleHours; private final List<DeploymentSpec.ChangeBlocker> changeBlockers; - private final Optional<String> globalServiceId; private final Optional<AthenzService> athenzService; private final Map<CloudName, CloudAccount> cloudAccounts; private final Optional<Duration> hostTTL; @@ -76,7 +74,6 @@ public class DeploymentInstanceSpec extends DeploymentSpec.Steps { DeploymentSpec.UpgradeRollout upgradeRollout, int minRisk, int maxRisk, int maxIdleHours, List<DeploymentSpec.ChangeBlocker> changeBlockers, - Optional<String> globalServiceId, Optional<AthenzService> athenzService, Map<CloudName, CloudAccount> cloudAccounts, Optional<Duration> hostTTL, @@ -100,7 +97,6 @@ public class DeploymentInstanceSpec extends DeploymentSpec.Steps { this.maxRisk = require(maxRisk >= minRisk, maxRisk, "maximum risk cannot be less than minimum risk score"); this.maxIdleHours = requireInRange(maxIdleHours, "maximum idle hours", 0, 168); this.changeBlockers = Objects.requireNonNull(changeBlockers); - this.globalServiceId = Objects.requireNonNull(globalServiceId); this.athenzService = Objects.requireNonNull(athenzService); this.cloudAccounts = Map.copyOf(cloudAccounts); this.hostTTL = Objects.requireNonNull(hostTTL); @@ -111,7 +107,7 @@ public class DeploymentInstanceSpec extends DeploymentSpec.Steps { this.zoneEndpoints = Collections.unmodifiableMap(zoneEndpointsCopy); this.bcp = Objects.requireNonNull(bcp); validateZones(new HashSet<>(), new HashSet<>(), this); - validateEndpoints(globalServiceId, this.endpoints); + validateEndpoints(this.endpoints); validateChangeBlockers(changeBlockers, now); validateBcp(bcp); hostTTL.filter(Duration::isNegative).ifPresent(ttl -> illegal("Host TTL cannot be negative")); @@ -155,11 +151,7 @@ public class DeploymentInstanceSpec extends DeploymentSpec.Steps { } /** Throw an IllegalArgumentException if an endpoint refers to a region that is not declared in 'prod' */ - private void validateEndpoints(Optional<String> globalServiceId, List<Endpoint> endpoints) { - if (globalServiceId.isPresent() && ! endpoints.isEmpty()) { - throw new IllegalArgumentException("Providing both 'endpoints' and 'global-service-id'. Use only 'endpoints'."); - } - + private void validateEndpoints(List<Endpoint> endpoints) { var regions = prodRegions(); for (var endpoint : endpoints){ for (var endpointRegion : endpoint.regions()) { @@ -243,9 +235,6 @@ public class DeploymentInstanceSpec extends DeploymentSpec.Steps { /** Returns time windows where upgrades are disallowed for these instances */ public List<DeploymentSpec.ChangeBlocker> changeBlocker() { return changeBlockers; } - /** Returns the ID of the service to expose through global routing, if present */ - public Optional<String> globalServiceId() { return globalServiceId; } - /** Returns whether the instances in this step can upgrade at the given instant */ public boolean canUpgradeAt(Instant instant) { return changeBlockers.stream().filter(block -> block.blocksVersions()) @@ -323,8 +312,7 @@ public class DeploymentInstanceSpec extends DeploymentSpec.Steps { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DeploymentInstanceSpec other = (DeploymentInstanceSpec) o; - return globalServiceId.equals(other.globalServiceId) && - upgradePolicy == other.upgradePolicy && + return upgradePolicy == other.upgradePolicy && revisionTarget == other.revisionTarget && upgradeRollout == other.upgradeRollout && changeBlockers.equals(other.changeBlockers) && @@ -339,7 +327,7 @@ public class DeploymentInstanceSpec extends DeploymentSpec.Steps { @Override public int hashCode() { - return Objects.hash(globalServiceId, upgradePolicy, revisionTarget, upgradeRollout, changeBlockers, steps(), athenzService, notifications, endpoints, zoneEndpoints, bcp, tags); + return Objects.hash(upgradePolicy, revisionTarget, upgradeRollout, changeBlockers, steps(), athenzService, notifications, endpoints, zoneEndpoints, bcp, tags); } int deployableHashCode() { @@ -349,7 +337,6 @@ public class DeploymentInstanceSpec extends DeploymentSpec.Steps { toHash[i++] = name; toHash[i++] = endpoints; toHash[i++] = zoneEndpoints; - toHash[i++] = globalServiceId; toHash[i++] = tags; toHash[i++] = bcp; toHash[i++] = cloudAccounts; diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java b/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java index 38562eefb03..13bc09883fa 100644 --- a/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java +++ b/config-model-api/src/main/java/com/yahoo/config/application/api/xml/DeploymentSpecXmlReader.java @@ -93,7 +93,6 @@ public class DeploymentSpecXmlReader { private static final String athenzDomainAttribute = "athenz-domain"; private static final String testerFlavorAttribute = "tester-flavor"; private static final String majorVersionAttribute = "major-version"; - private static final String globalServiceIdAttribute = "global-service-id"; private static final String cloudAccountAttribute = "cloud-account"; private static final String hostTTLAttribute = "empty-host-ttl"; @@ -234,7 +233,6 @@ public class DeploymentSpecXmlReader { upgradeRollout, minRisk, maxRisk, maxIdleHours, changeBlockers, - Optional.ofNullable(prodAttributes.get(globalServiceIdAttribute)), athenzService, cloudAccounts, hostTTL, @@ -268,12 +266,6 @@ public class DeploymentSpecXmlReader { Optional<AthenzService> athenzService = mostSpecificAttribute(stepTag, athenzServiceAttribute).map(AthenzService::from); Optional<String> testerFlavor = mostSpecificAttribute(stepTag, testerFlavorAttribute); - if (prodTag.equals(stepTag.getTagName())) { - readGlobalServiceId(stepTag).ifPresent(id -> prodAttributes.put(globalServiceIdAttribute, id)); - } else { - if (readGlobalServiceId(stepTag).isPresent()) illegal("Attribute '" + globalServiceIdAttribute + "' is only valid on 'prod' tag"); - } - switch (stepTag.getTagName()) { case testTag: if (Stream.iterate(stepTag, Objects::nonNull, Node::getParentNode) @@ -714,13 +706,6 @@ public class DeploymentSpecXmlReader { return mostSpecificAttribute(tag, hostTTLAttribute).map(s -> toDuration(s, "empty host TTL")); } - private Optional<String> readGlobalServiceId(Element environmentTag) { - String globalServiceId = environmentTag.getAttribute(globalServiceIdAttribute); - if (globalServiceId.isEmpty()) return Optional.empty(); - deprecate(environmentTag, List.of(globalServiceIdAttribute), 7, "See https://cloud.vespa.ai/en/reference/routing#deprecated-syntax"); - return Optional.of(globalServiceId); - } - private List<DeploymentSpec.ChangeBlocker> readChangeBlockers(Element parent, Element globalBlockersParent) { List<DeploymentSpec.ChangeBlocker> changeBlockers = new ArrayList<>(); if (globalBlockersParent != parent) { |