diff options
author | jonmv <venstad@gmail.com> | 2023-05-30 11:59:25 +0200 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2023-05-30 11:59:25 +0200 |
commit | 9d59de7b07d5476ed587df0c361406fb3ce4b368 (patch) | |
tree | a6451f05b1b15f2e719f27706f7f076c8d4e0030 /config-model-api/src/main/java/com/yahoo/config/application | |
parent | cdd9d7bb5fcdb154f6cc9fa129d3a65e22f7a63a (diff) |
Respect host TTL (and cloud account) for tester deployments
Diffstat (limited to 'config-model-api/src/main/java/com/yahoo/config/application')
2 files changed, 16 insertions, 2 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java b/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java index 43fdb32f3a2..ec79f9e554a 100644 --- a/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java +++ b/config-model-api/src/main/java/com/yahoo/config/application/api/DeploymentSpec.java @@ -387,6 +387,8 @@ public class DeploymentSpec { return true; } + public Optional<Duration> hostTTL() { return Optional.empty(); } + } /** A deployment step which is to wait for some time before progressing to the next step */ @@ -495,6 +497,7 @@ public class DeploymentSpec { return environment + (region.map(regionName -> "." + regionName).orElse("")); } + @Override public Optional<Duration> hostTTL() { return hostTTL; } @@ -505,9 +508,15 @@ public class DeploymentSpec { public static class DeclaredTest extends Step { private final RegionName region; + private final Optional<Duration> hostTTL; - public DeclaredTest(RegionName region) { + public DeclaredTest(RegionName region, Optional<CloudAccount> cloudAccount, Optional<Duration> hostTTL) { this.region = Objects.requireNonNull(region); + this.hostTTL = Objects.requireNonNull(hostTTL); + hostTTL.ifPresent(ttl -> { + if (cloudAccount.isEmpty()) illegal("Host TTL can only be specified with custom cloud accounts"); + if (ttl.isNegative()) illegal("Host TTL cannot be negative"); + }); } @Override @@ -524,6 +533,11 @@ public class DeploymentSpec { } @Override + public Optional<Duration> hostTTL() { + return hostTTL; + } + + @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; 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 db00ad4a421..f265ad3bb71 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 @@ -277,7 +277,7 @@ public class DeploymentSpecXmlReader { case testTag: if (Stream.iterate(stepTag, Objects::nonNull, Node::getParentNode) .anyMatch(node -> prodTag.equals(node.getNodeName()))) { - return List.of(new DeclaredTest(RegionName.from(XML.getValue(stepTag).trim()))); // A production test + return List.of(new DeclaredTest(RegionName.from(XML.getValue(stepTag).trim()), readCloudAccount(stepTag), readHostTTL(stepTag))); // A production test } case devTag, perfTag, stagingTag: // Intentional fallthrough from test tag. return List.of(new DeclaredZone(Environment.from(stepTag.getTagName()), Optional.empty(), false, athenzService, testerFlavor, readCloudAccount(stepTag), readHostTTL(stepTag))); |