diff options
author | Håkon Hallingstad <hakon@yahooinc.com> | 2023-10-16 14:19:40 +0200 |
---|---|---|
committer | Håkon Hallingstad <hakon@yahooinc.com> | 2023-10-16 14:19:40 +0200 |
commit | 3d4ed6313d47b92b39d1d215a04c059eff06ffd2 (patch) | |
tree | c6888a992a7ea1c1b533397a831ac692315763fa /config-provisioning | |
parent | 0ccfe8aab8c12ecd518f882a048f8a13fb2084f1 (diff) |
Set provisioned-for if enabled and application has exclusive="true"
Diffstat (limited to 'config-provisioning')
-rw-r--r-- | config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java b/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java index ed0f9aac884..04aced68d1b 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java @@ -2,8 +2,6 @@ package com.yahoo.config.provision; import com.yahoo.component.Version; -import com.yahoo.config.provision.ZoneEndpoint.AccessType; -import com.yahoo.config.provision.ZoneEndpoint.AllowedUrn; import java.util.Objects; import java.util.Optional; @@ -24,19 +22,21 @@ public final class ClusterSpec { private final Version vespaVersion; private final boolean exclusive; + private final boolean provisionForApplication; private final Optional<Id> combinedId; private final Optional<DockerImage> dockerImageRepo; private final ZoneEndpoint zoneEndpoint; private final boolean stateful; private ClusterSpec(Type type, Id id, Optional<Group> groupId, Version vespaVersion, boolean exclusive, - Optional<Id> combinedId, Optional<DockerImage> dockerImageRepo, + boolean provisionForApplication, Optional<Id> combinedId, Optional<DockerImage> dockerImageRepo, ZoneEndpoint zoneEndpoint, boolean stateful) { this.type = type; this.id = id; this.groupId = groupId; this.vespaVersion = Objects.requireNonNull(vespaVersion, "vespaVersion cannot be null"); this.exclusive = exclusive; + this.provisionForApplication = provisionForApplication; if (type == Type.combined) { if (combinedId.isEmpty()) throw new IllegalArgumentException("combinedId must be set for cluster of type " + type); } else { @@ -85,21 +85,22 @@ public final class ClusterSpec { */ public boolean isExclusive() { return exclusive; } + /** Returns whether the physical hosts must be provisioned specifically for this application. */ + public boolean provisionForApplication() { return provisionForApplication; } + /** Returns whether this cluster has state */ public boolean isStateful() { return stateful; } public ClusterSpec with(Optional<Group> newGroup) { - return new ClusterSpec(type, id, newGroup, vespaVersion, exclusive, combinedId, dockerImageRepo, zoneEndpoint, stateful); + return new ClusterSpec(type, id, newGroup, vespaVersion, exclusive, provisionForApplication, combinedId, dockerImageRepo, zoneEndpoint, stateful); } public ClusterSpec withExclusivity(boolean exclusive) { - return new ClusterSpec(type, id, groupId, vespaVersion, exclusive, combinedId, dockerImageRepo, zoneEndpoint, stateful); + return new ClusterSpec(type, id, groupId, vespaVersion, exclusive, provisionForApplication, combinedId, dockerImageRepo, zoneEndpoint, stateful); } - // TODO: Remove after July 2023 - @Deprecated - public ClusterSpec exclusive(boolean exclusive) { - return new ClusterSpec(type, id, groupId, vespaVersion, exclusive, combinedId, dockerImageRepo, zoneEndpoint, stateful); + public ClusterSpec withProvisionForApplication(boolean provisionForApplication) { + return new ClusterSpec(type, id, groupId, vespaVersion, exclusive, provisionForApplication, combinedId, dockerImageRepo, zoneEndpoint, stateful); } /** Creates a ClusterSpec when requesting a cluster */ @@ -121,6 +122,7 @@ public final class ClusterSpec { private Optional<DockerImage> dockerImageRepo = Optional.empty(); private Version vespaVersion; private boolean exclusive = false; + private boolean provisionForApplication = false; private Optional<Id> combinedId = Optional.empty(); private ZoneEndpoint zoneEndpoint = ZoneEndpoint.defaultEndpoint; private boolean stateful; @@ -132,7 +134,7 @@ public final class ClusterSpec { } public ClusterSpec build() { - return new ClusterSpec(type, id, groupId, vespaVersion, exclusive, combinedId, dockerImageRepo, zoneEndpoint, stateful); + return new ClusterSpec(type, id, groupId, vespaVersion, exclusive, provisionForApplication, combinedId, dockerImageRepo, zoneEndpoint, stateful); } public Builder group(Group groupId) { @@ -155,6 +157,11 @@ public final class ClusterSpec { return this; } + public Builder provisionForApplication(boolean provisionForApplication) { + this.provisionForApplication = provisionForApplication; + return this; + } + public Builder combinedId(Optional<Id> combinedId) { this.combinedId = combinedId; return this; @@ -188,6 +195,7 @@ public final class ClusterSpec { if (o == null || getClass() != o.getClass()) return false; ClusterSpec that = (ClusterSpec) o; return exclusive == that.exclusive && + provisionForApplication == that.provisionForApplication && stateful == that.stateful && type == that.type && id.equals(that.id) && @@ -200,7 +208,7 @@ public final class ClusterSpec { @Override public int hashCode() { - return Objects.hash(type, id, groupId, vespaVersion, exclusive, combinedId, dockerImageRepo, zoneEndpoint, stateful); + return Objects.hash(type, id, groupId, vespaVersion, exclusive, provisionForApplication, combinedId, dockerImageRepo, zoneEndpoint, stateful); } /** |