aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@yahooinc.com>2023-10-29 18:22:11 +0100
committerHåkon Hallingstad <hakon@yahooinc.com>2023-10-29 18:22:11 +0100
commitbae328cbbffe5b2acc8fb790764968cdfd40b991 (patch)
tree0b2bfb0798c9c7185ed858908f17c8e8cb691eab
parentbe8c33274cef3bbc5374876ad5d0283dcb62b25b (diff)
Allow preprovisioning with cluster IDhakonhall/enumerate-all-prod-regions
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java2
-rw-r--r--flags/src/main/java/com/yahoo/vespa/flags/custom/ClusterCapacity.java87
-rw-r--r--flags/src/test/java/com/yahoo/vespa/flags/custom/ClusterCapacityTest.java22
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainer.java80
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainerTest.java34
5 files changed, 120 insertions, 105 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 bb9bf8db4f3..6bbd470840e 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
@@ -231,6 +231,8 @@ public final class ClusterSpec {
return this == container || this == combined;
}
+ public String value() { return name(); }
+
public static Type from(String typeName) {
return switch (typeName) {
case "admin" -> admin;
diff --git a/flags/src/main/java/com/yahoo/vespa/flags/custom/ClusterCapacity.java b/flags/src/main/java/com/yahoo/vespa/flags/custom/ClusterCapacity.java
index 8ac83f2b2aa..f3272920bfb 100644
--- a/flags/src/main/java/com/yahoo/vespa/flags/custom/ClusterCapacity.java
+++ b/flags/src/main/java/com/yahoo/vespa/flags/custom/ClusterCapacity.java
@@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
+import java.util.Optional;
import java.util.OptionalDouble;
import static com.yahoo.vespa.flags.custom.Validation.requireNonNegative;
@@ -32,10 +33,11 @@ public class ClusterCapacity {
private final String diskSpeed;
private final String storageType;
private final String architecture;
- private final String clusterType;
+ private final Optional<String> clusterType;
+ private final Optional<String> clusterId;
@JsonCreator
- public ClusterCapacity(@JsonProperty("count") int count,
+ public ClusterCapacity(@JsonProperty("count") Integer count,
@JsonProperty("vcpu") Double vcpu,
@JsonProperty("memoryGb") Double memoryGb,
@JsonProperty("diskGb") Double diskGb,
@@ -43,8 +45,9 @@ public class ClusterCapacity {
@JsonProperty("diskSpeed") String diskSpeed,
@JsonProperty("storageType") String storageType,
@JsonProperty("architecture") String architecture,
- @JsonProperty("clusterType") String clusterType) {
- this.count = (int) requireNonNegative("count", count);
+ @JsonProperty("clusterType") String clusterType,
+ @JsonProperty("clusterId") String clusterId) {
+ this.count = count == null ? 1 : (int) requireNonNegative("count", count);
this.vcpu = vcpu == null ? OptionalDouble.empty() : OptionalDouble.of(requireNonNegative("vcpu", vcpu));
this.memoryGb = memoryGb == null ? OptionalDouble.empty() : OptionalDouble.of(requireNonNegative("memoryGb", memoryGb));
this.diskGb = diskGb == null ? OptionalDouble.empty() : OptionalDouble.of(requireNonNegative("diskGb", diskGb));
@@ -52,51 +55,42 @@ public class ClusterCapacity {
this.diskSpeed = validateEnum("diskSpeed", validDiskSpeeds, diskSpeed == null ? "fast" : diskSpeed);
this.storageType = validateEnum("storageType", validStorageTypes, storageType == null ? "any" : storageType);
this.architecture = validateEnum("architecture", validArchitectures, architecture == null ? "x86_64" : architecture);
- this.clusterType = clusterType == null ? null : validateEnum("clusterType", validClusterTypes, clusterType);
- }
-
- /** Returns a new ClusterCapacity equal to {@code this}, but with the given count. */
- public ClusterCapacity withCount(int count) {
- return new ClusterCapacity(count, vcpuOrNull(), memoryGbOrNull(), diskGbOrNull(), bandwidthGbpsOrNull(),
- diskSpeed, storageType, architecture, clusterType);
+ this.clusterType = clusterType == null ? Optional.empty() : Optional.of(validateEnum("clusterType", validClusterTypes, clusterType));
+ this.clusterId = clusterId == null ? Optional.empty() : Optional.of(clusterId);
}
@JsonGetter("count") public int count() { return count; }
- @JsonGetter("vcpu") public Double vcpuOrNull() {
- return vcpu.isPresent() ? vcpu.getAsDouble() : null;
- }
- @JsonGetter("memoryGb") public Double memoryGbOrNull() {
- return memoryGb.isPresent() ? memoryGb.getAsDouble() : null;
- }
- @JsonGetter("diskGb") public Double diskGbOrNull() {
- return diskGb.isPresent() ? diskGb.getAsDouble() : null;
- }
- @JsonGetter("bandwidthGbps") public Double bandwidthGbpsOrNull() {
- return bandwidthGbps.isPresent() ? bandwidthGbps.getAsDouble() : null;
- }
+ @JsonGetter("vcpu") public Double vcpuOrNull() { return vcpu.isPresent() ? vcpu.getAsDouble() : null; }
+ @JsonGetter("memoryGb") public Double memoryGbOrNull() { return memoryGb.isPresent() ? memoryGb.getAsDouble() : null; }
+ @JsonGetter("diskGb") public Double diskGbOrNull() { return diskGb.isPresent() ? diskGb.getAsDouble() : null; }
+ @JsonGetter("bandwidthGbps") public Double bandwidthGbpsOrNull() { return bandwidthGbps.isPresent() ? bandwidthGbps.getAsDouble() : null; }
@JsonGetter("diskSpeed") public String diskSpeed() { return diskSpeed; }
@JsonGetter("storageType") public String storageType() { return storageType; }
@JsonGetter("architecture") public String architecture() { return architecture; }
- @JsonGetter("clusterType") public String clusterType() { return clusterType; }
+ @JsonGetter("clusterType") public String clusterTypeOrNull() { return clusterType.orElse(null); }
+ @JsonGetter("clusterId") public String clusterIdOrNull() { return clusterId.orElse(null); }
- @JsonIgnore public Double vcpu() { return vcpu.orElse(0.0); }
- @JsonIgnore public Double memoryGb() { return memoryGb.orElse(0.0); }
- @JsonIgnore public Double diskGb() { return diskGb.orElse(0.0); }
+ @JsonIgnore public double vcpu() { return vcpu.orElse(0.0); }
+ @JsonIgnore public double memoryGb() { return memoryGb.orElse(0.0); }
+ @JsonIgnore public double diskGb() { return diskGb.orElse(0.0); }
@JsonIgnore public double bandwidthGbps() { return bandwidthGbps.orElse(1.0); }
+ @JsonIgnore public Optional<String> clusterType() { return clusterType; }
+ @JsonIgnore public Optional<String> clusterId() { return clusterId; }
@Override
public String toString() {
return "ClusterCapacity{" +
- "count=" + count +
- ", vcpu=" + vcpu +
- ", memoryGb=" + memoryGb +
- ", diskGb=" + diskGb +
- ", bandwidthGbps=" + bandwidthGbps +
- ", diskSpeed=" + diskSpeed +
- ", storageType=" + storageType +
- ", architecture=" + architecture +
- ", clusterType=" + clusterType +
- '}';
+ "count=" + count +
+ ", vcpu=" + vcpu +
+ ", memoryGb=" + memoryGb +
+ ", diskGb=" + diskGb +
+ ", bandwidthGbps=" + bandwidthGbps +
+ ", diskSpeed=" + diskSpeed +
+ ", storageType=" + storageType +
+ ", architecture=" + architecture +
+ ", clusterType=" + clusterType +
+ ", clusterId=" + clusterId +
+ '}';
}
@Override
@@ -105,19 +99,20 @@ public class ClusterCapacity {
if (o == null || getClass() != o.getClass()) return false;
ClusterCapacity that = (ClusterCapacity) o;
return count == that.count &&
- vcpu.equals(that.vcpu) &&
- memoryGb.equals(that.memoryGb) &&
- diskGb.equals(that.diskGb) &&
- bandwidthGbps.equals(that.bandwidthGbps) &&
- diskSpeed.equals(that.diskSpeed) &&
- storageType.equals(that.storageType) &&
- architecture.equals(that.architecture) &&
- clusterType.equals(that.clusterType);
+ vcpu.equals(that.vcpu) &&
+ memoryGb.equals(that.memoryGb) &&
+ diskGb.equals(that.diskGb) &&
+ bandwidthGbps.equals(that.bandwidthGbps) &&
+ diskSpeed.equals(that.diskSpeed) &&
+ storageType.equals(that.storageType) &&
+ architecture.equals(that.architecture) &&
+ clusterType.equals(that.clusterType) &&
+ clusterId.equals(that.clusterId);
}
@Override
public int hashCode() {
- return Objects.hash(count, vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, clusterType);
+ return Objects.hash(count, vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, clusterType, clusterId);
}
}
diff --git a/flags/src/test/java/com/yahoo/vespa/flags/custom/ClusterCapacityTest.java b/flags/src/test/java/com/yahoo/vespa/flags/custom/ClusterCapacityTest.java
index 1d2e550aa7a..6a8d97b459f 100644
--- a/flags/src/test/java/com/yahoo/vespa/flags/custom/ClusterCapacityTest.java
+++ b/flags/src/test/java/com/yahoo/vespa/flags/custom/ClusterCapacityTest.java
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import java.io.IOException;
+import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -12,7 +13,7 @@ public class ClusterCapacityTest {
@Test
void serialization() throws IOException {
- ClusterCapacity clusterCapacity = new ClusterCapacity(7, 1.2, 3.4, 5.6, null, "fast", "local", "x86_64", null);
+ ClusterCapacity clusterCapacity = new ClusterCapacity(7, 1.2, 3.4, 5.6, null, "fast", "local", "x86_64", null, null);
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(clusterCapacity);
assertEquals("""
@@ -28,11 +29,13 @@ public class ClusterCapacityTest {
assertEquals("fast", deserialized.diskSpeed());
assertEquals("local", deserialized.storageType());
assertEquals("x86_64", deserialized.architecture());
+ assertEquals(Optional.empty(), deserialized.clusterType());
+ assertEquals(Optional.empty(), deserialized.clusterId());
}
@Test
void serialization2() throws IOException {
- ClusterCapacity clusterCapacity = new ClusterCapacity(7, 1.2, 3.4, 5.6, 2.3, "any", "remote", "arm64", null);
+ ClusterCapacity clusterCapacity = new ClusterCapacity(7, 1.2, 3.4, 5.6, 2.3, "any", "remote", "arm64", null, null);
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(clusterCapacity);
assertEquals("""
@@ -48,15 +51,17 @@ public class ClusterCapacityTest {
assertEquals("any", deserialized.diskSpeed());
assertEquals("remote", deserialized.storageType());
assertEquals("arm64", deserialized.architecture());
+ assertEquals(Optional.empty(), deserialized.clusterType());
+ assertEquals(Optional.empty(), deserialized.clusterId());
}
@Test
void serialization3() throws IOException {
- ClusterCapacity clusterCapacity = new ClusterCapacity(7, 1.2, 3.4, 5.6, 2.3, "any", "remote", "arm64", "admin");
+ ClusterCapacity clusterCapacity = new ClusterCapacity(7, 1.2, 3.4, 5.6, 2.3, "any", "remote", "arm64", "admin", "id");
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(clusterCapacity);
assertEquals("""
- {"count":7,"vcpu":1.2,"memoryGb":3.4,"diskGb":5.6,"bandwidthGbps":2.3,"diskSpeed":"any","storageType":"remote","architecture":"arm64","clusterType":"admin"}""",
+ {"count":7,"vcpu":1.2,"memoryGb":3.4,"diskGb":5.6,"bandwidthGbps":2.3,"diskSpeed":"any","storageType":"remote","architecture":"arm64","clusterType":"admin","clusterId":"id"}""",
json);
ClusterCapacity deserialized = mapper.readValue(json, ClusterCapacity.class);
@@ -68,12 +73,13 @@ public class ClusterCapacityTest {
assertEquals("any", deserialized.diskSpeed());
assertEquals("remote", deserialized.storageType());
assertEquals("arm64", deserialized.architecture());
- assertEquals("admin", deserialized.clusterType());
+ assertEquals(Optional.of("admin"), deserialized.clusterType());
+ assertEquals(Optional.of("id"), deserialized.clusterId());
}
@Test
void serializationWithNoNodeResources() throws IOException {
- ClusterCapacity clusterCapacity = new ClusterCapacity(7, null, null, null, null, null, null, null, null);
+ ClusterCapacity clusterCapacity = new ClusterCapacity(7, null, null, null, null, null, null, null, null, null);
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(clusterCapacity);
assertEquals("{\"count\":7,\"diskSpeed\":\"fast\",\"storageType\":\"any\",\"architecture\":\"x86_64\"}", json);
@@ -87,6 +93,8 @@ public class ClusterCapacityTest {
assertEquals("fast", deserialized.diskSpeed());
assertEquals("any", deserialized.storageType());
assertEquals("x86_64", deserialized.architecture());
+ assertEquals(Optional.empty(), deserialized.clusterType());
+ assertEquals(Optional.empty(), deserialized.clusterId());
// Test that using no values for diskSpeed, storageType and architecture will give expected values (the default values)
@@ -100,6 +108,8 @@ public class ClusterCapacityTest {
assertEquals("fast", deserialized.diskSpeed());
assertEquals("any", deserialized.storageType());
assertEquals("x86_64", deserialized.architecture());
+ assertEquals(Optional.empty(), deserialized.clusterType());
+ assertEquals(Optional.empty(), deserialized.clusterId());
}
}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainer.java
index be6c420c63b..3f7c2a296af 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainer.java
@@ -199,7 +199,7 @@ public class HostCapacityMaintainer extends NodeRepositoryMaintainer {
var nodesPlusProvisioned = new ArrayList<>(nodeList.asList());
for (int numProvisions = 0;; ++numProvisions) {
var nodesPlusProvisionedPlusAllocated = new ArrayList<>(nodesPlusProvisioned);
- Optional<ClusterCapacity> deficit = allocatePreprovisionCapacity(preprovisionCapacity, nodesPlusProvisionedPlusAllocated, makeExclusive);
+ Optional<ClusterDeficit> deficit = allocatePreprovisionCapacity(preprovisionCapacity, nodesPlusProvisionedPlusAllocated, makeExclusive);
if (deficit.isEmpty()) {
return nodesPlusProvisionedPlusAllocated;
}
@@ -208,26 +208,30 @@ public class HostCapacityMaintainer extends NodeRepositoryMaintainer {
throw new IllegalStateException("Have provisioned " + numProvisions + " times but there's still deficit: aborting");
}
- ClusterCapacity clusterCapacityDeficit = deficit.get();
- nodesPlusProvisioned.addAll(provisionHosts(clusterCapacityDeficit.count(),
- toNodeResources(clusterCapacityDeficit),
- Optional.ofNullable(clusterCapacityDeficit.clusterType()),
- nodeList));
+ nodesPlusProvisioned.addAll(provisionHosts(deficit.get(), nodeList));
}
}
- private List<Node> provisionHosts(int count, NodeResources nodeResources, Optional<String> clusterType, NodeList allNodes) {
+ private List<Node> provisionHosts(ClusterDeficit deficit, NodeList allNodes) {
+ NodeResources nodeResources = toNodeResources(deficit.capacity());
+
try {
if (throttler.throttle(allNodes, Agent.HostCapacityMaintainer)) {
throw new NodeAllocationException("Host provisioning is being throttled", true);
}
Version osVersion = nodeRepository().osVersions().targetFor(NodeType.host).orElse(Version.emptyVersion);
- List<Integer> provisionIndices = nodeRepository().database().readProvisionIndices(count);
- HostSharing sharingMode = nodeRepository().exclusiveAllocation(asSpec(clusterType, 0)) ? HostSharing.exclusive : HostSharing.shared;
- HostProvisionRequest request = new HostProvisionRequest(provisionIndices, NodeType.host, nodeResources,
- ApplicationId.defaultId(), osVersion,
- sharingMode, clusterType.map(ClusterSpec.Type::valueOf), Optional.empty(),
- nodeRepository().zone().cloud().account(), false);
+ List<Integer> provisionIndices = nodeRepository().database().readProvisionIndices(deficit.count());
+ HostSharing sharingMode = nodeRepository().exclusiveAllocation(deficit.spec()) ? HostSharing.exclusive : HostSharing.shared;
+ HostProvisionRequest request = new HostProvisionRequest(provisionIndices,
+ NodeType.host,
+ nodeResources,
+ ApplicationId.defaultId(),
+ osVersion,
+ sharingMode,
+ deficit.capacity().clusterType().map(ClusterSpec.Type::valueOf),
+ deficit.capacity.clusterId().map(ClusterSpec.Id::from),
+ nodeRepository().zone().cloud().account(),
+ false);
List<Node> hosts = new ArrayList<>();
Runnable waiter;
try (var lock = nodeRepository().nodes().lockUnallocated()) {
@@ -244,13 +248,15 @@ public class HostCapacityMaintainer extends NodeRepositoryMaintainer {
waiter.run();
return hosts;
} catch (NodeAllocationException | IllegalArgumentException | IllegalStateException e) {
- throw new NodeAllocationException("Failed to provision " + count + " " + nodeResources + ": " + e.getMessage(),
+ throw new NodeAllocationException("Failed to provision " + deficit.count() + " " + nodeResources + ": " + e.getMessage(),
! (e instanceof NodeAllocationException nae) || nae.retryable());
} catch (RuntimeException e) {
- throw new RuntimeException("Failed to provision " + count + " " + nodeResources + ", will retry in " + interval(), e);
+ throw new RuntimeException("Failed to provision " + deficit.count() + " " + nodeResources + ", will retry in " + interval(), e);
}
}
+ private record ClusterDeficit(ClusterCapacity capacity, ClusterSpec spec, int count) { }
+
/**
* Try to allocate the preprovision cluster capacity.
*
@@ -258,17 +264,16 @@ public class HostCapacityMaintainer extends NodeRepositoryMaintainer {
* they are added to {@code mutableNodes}
* @return the part of a cluster capacity it was unable to allocate, if any
*/
- private Optional<ClusterCapacity> allocatePreprovisionCapacity(List<ClusterCapacity> preprovisionCapacity,
- ArrayList<Node> mutableNodes,
- boolean makeExclusive) {
+ private Optional<ClusterDeficit> allocatePreprovisionCapacity(List<ClusterCapacity> preprovisionCapacity,
+ ArrayList<Node> mutableNodes,
+ boolean makeExclusive) {
for (int clusterIndex = 0; clusterIndex < preprovisionCapacity.size(); ++clusterIndex) {
- ClusterCapacity clusterCapacity = preprovisionCapacity.get(clusterIndex);
+ ClusterCapacity capacity = preprovisionCapacity.get(clusterIndex);
+ ClusterSpec spec = asSpec(capacity, clusterIndex);
LockedNodeList allNodes = new LockedNodeList(mutableNodes, () -> {});
- List<Node> candidates = findCandidates(clusterCapacity, clusterIndex, allNodes, makeExclusive);
- int deficit = Math.max(0, clusterCapacity.count() - candidates.size());
- if (deficit > 0) {
- return Optional.of(clusterCapacity.withCount(deficit));
- }
+ List<Node> candidates = findCandidates(capacity, spec, allNodes, makeExclusive);
+ int deficit = capacity.count() - candidates.size();
+ if (deficit > 0) return Optional.of(new ClusterDeficit(capacity, spec, deficit));
// Simulate allocating the cluster
mutableNodes.addAll(candidates);
@@ -277,26 +282,32 @@ public class HostCapacityMaintainer extends NodeRepositoryMaintainer {
return Optional.empty();
}
- private List<Node> findCandidates(ClusterCapacity clusterCapacity, int clusterIndex, LockedNodeList allNodes, boolean makeExclusive) {
+ private static ClusterSpec asSpec(ClusterCapacity clusterCapacity, int clusterIndex) {
+ return ClusterSpec.request(clusterCapacity.clusterType().map(ClusterSpec.Type::from).orElse(ClusterSpec.Type.content),
+ ClusterSpec.Id.from(clusterCapacity.clusterId().orElse(String.valueOf(clusterIndex))))
+ .vespaVersion(Vtag.currentVersion) // Needed, but should not be used here.
+ .build();
+ }
+
+ private List<Node> findCandidates(ClusterCapacity clusterCapacity, ClusterSpec spec, LockedNodeList allNodes, boolean makeExclusive) {
NodeResources nodeResources = toNodeResources(clusterCapacity);
// We'll allocate each ClusterCapacity as a unique cluster in a dummy application
ApplicationId applicationId = ApplicationId.defaultId();
- ClusterSpec cluster = asSpec(Optional.ofNullable(clusterCapacity.clusterType()), clusterIndex);
NodeSpec nodeSpec = NodeSpec.from(clusterCapacity.count(), 1, nodeResources, false, true,
nodeRepository().zone().cloud().account(), Duration.ZERO);
var allocationContext = IP.Allocation.Context.from(nodeRepository().zone().cloud().name(),
nodeSpec.cloudAccount().isExclave(nodeRepository().zone()),
nodeRepository().nameResolver());
- NodePrioritizer prioritizer = new NodePrioritizer(allNodes, applicationId, cluster, nodeSpec,
+ NodePrioritizer prioritizer = new NodePrioritizer(allNodes, applicationId, spec, nodeSpec,
true, false, allocationContext, nodeRepository().nodes(),
nodeRepository().resourcesCalculator(), nodeRepository().spareCount(),
- nodeRepository().exclusiveAllocation(cluster), makeExclusive);
+ nodeRepository().exclusiveAllocation(spec), makeExclusive);
List<NodeCandidate> nodeCandidates = prioritizer.collect()
.stream()
- .filter(node -> node.violatesExclusivity(cluster,
+ .filter(node -> node.violatesExclusivity(spec,
applicationId,
- nodeRepository().exclusiveAllocation(cluster),
+ nodeRepository().exclusiveAllocation(spec),
false,
nodeRepository().zone().cloud().allowHostSharing(),
allNodes,
@@ -309,19 +320,12 @@ public class HostCapacityMaintainer extends NodeRepositoryMaintainer {
.limit(clusterCapacity.count())
.map(candidate -> candidate.toNode()
.allocate(applicationId,
- ClusterMembership.from(cluster, index.next()),
+ ClusterMembership.from(spec, index.next()),
nodeResources,
nodeRepository().clock().instant()))
.toList();
}
- private static ClusterSpec asSpec(Optional<String> clusterType, int index) {
- return ClusterSpec.request(clusterType.map(ClusterSpec.Type::from).orElse(ClusterSpec.Type.content),
- ClusterSpec.Id.from(String.valueOf(index)))
- .vespaVersion(Vtag.currentVersion) // Needed, but should not be used here.
- .build();
- }
-
private static NodeResources toNodeResources(ClusterCapacity clusterCapacity) {
return new NodeResources(clusterCapacity.vcpu(),
clusterCapacity.memoryGb(),
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainerTest.java
index c804ade668c..5a5215f9a04 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainerTest.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainerTest.java
@@ -99,7 +99,7 @@ public class HostCapacityMaintainerTest {
@Test
public void does_not_deprovision_when_preprovisioning_enabled() {
tester = new DynamicProvisioningTester().addInitialNodes();
- setPreprovisionCapacityFlag(tester, new ClusterCapacity(1, 1.0, 3.0, 2.0, 1.0, "fast", "remote", "x86_64", null));
+ setPreprovisionCapacityFlag(tester, new ClusterCapacity(1, 1.0, 3.0, 2.0, 1.0, "fast", "remote", "x86_64", null, null));
Optional<Node> failedHost = node("host2");
assertTrue(failedHost.isPresent());
@@ -112,8 +112,8 @@ public class HostCapacityMaintainerTest {
public void provision_deficit_and_deprovision_excess() {
tester = new DynamicProvisioningTester().addInitialNodes();
setPreprovisionCapacityFlag(tester,
- new ClusterCapacity(2, 48.0, 128.0, 1000.0, 10.0, "fast", "remote", "x86_64", null),
- new ClusterCapacity(1, 16.0, 24.0, 100.0, 1.0, "fast", "remote", "x86_64", null));
+ new ClusterCapacity(2, 48.0, 128.0, 1000.0, 10.0, "fast", "remote", "x86_64", null, null),
+ new ClusterCapacity(1, 16.0, 24.0, 100.0, 1.0, "fast", "remote", "x86_64", null, null));
assertEquals(0, tester.hostProvisioner.provisionedHosts().size());
assertEquals(9, tester.nodeRepository.nodes().list().size());
@@ -149,7 +149,7 @@ public class HostCapacityMaintainerTest {
tester = new DynamicProvisioningTester().addInitialNodes();
// Makes provisioned hosts 48-128-1000-10
tester.hostProvisioner.setHostFlavor("host4");
- var clusterCapacity = new ClusterCapacity(2, 1.0, 30.0, 20.0, 3.0, "fast", "remote", "x86_64", null);
+ var clusterCapacity = new ClusterCapacity(2, 1.0, 30.0, 20.0, 3.0, "fast", "remote", "x86_64", null, null);
setPreprovisionCapacityFlag(tester, clusterCapacity);
assertEquals(0, tester.hostProvisioner.provisionedHosts().size());
@@ -182,7 +182,7 @@ public class HostCapacityMaintainerTest {
setPreprovisionCapacityFlag(tester,
clusterCapacity,
- new ClusterCapacity(2, 24.0, 64.0, 100.0, 1.0, "fast", "remote", "x86_64", null));
+ new ClusterCapacity(2, 24.0, 64.0, 100.0, 1.0, "fast", "remote", "x86_64", null, null));
tester.maintain();
@@ -196,7 +196,7 @@ public class HostCapacityMaintainerTest {
// If the preprovision capacity is reduced, we should see shared hosts deprovisioned.
setPreprovisionCapacityFlag(tester,
- new ClusterCapacity(1, 1.0, 30.0, 20.0, 3.0, "fast", "remote", "x86_64", null));
+ new ClusterCapacity(1, 1.0, 30.0, 20.0, 3.0, "fast", "remote", "x86_64", null, null));
tester.maintain();
@@ -214,8 +214,8 @@ public class HostCapacityMaintainerTest {
// If a host with another architecture is added to preprovision capacity, a shared host should be added.
setPreprovisionCapacityFlag(tester,
- new ClusterCapacity(1, 2.0, 30.0, 20.0, 3.0, "fast", "remote", "x86_64", null),
- new ClusterCapacity(1, 2.0, 30.0, 20.0, 3.0, "fast", "remote", "arm64", null));
+ new ClusterCapacity(1, 2.0, 30.0, 20.0, 3.0, "fast", "remote", "x86_64", null, null),
+ new ClusterCapacity(1, 2.0, 30.0, 20.0, 3.0, "fast", "remote", "arm64", null, null));
tester.hostProvisioner.setHostFlavor("arm64");
tester.maintain();
@@ -229,7 +229,7 @@ public class HostCapacityMaintainerTest {
tester = new DynamicProvisioningTester(); // No nodes initially
// Makes provisioned hosts 2-30-20-3-arm64
tester.hostProvisioner.setHostFlavor("arm64");
- var clusterCapacity = new ClusterCapacity(1, 0.0, 0.0, 0.0, 0.0, null, null, "arm64", null);
+ var clusterCapacity = new ClusterCapacity(1, 0.0, 0.0, 0.0, 0.0, null, null, "arm64", null, null);
setPreprovisionCapacityFlag(tester, clusterCapacity);
assertEquals(0, tester.hostProvisioner.provisionedHosts().size());
@@ -245,7 +245,7 @@ public class HostCapacityMaintainerTest {
verifyFirstMaintainArm64(tester);
// Add a second cluster for cluster type admin. Need new hosts
- setPreprovisionCapacityFlag(tester, clusterCapacity, new ClusterCapacity(2, 0.0, 0.0, 0.0, 0.0, null, null, "arm64", "admin"));
+ setPreprovisionCapacityFlag(tester, clusterCapacity, new ClusterCapacity(2, 0.0, 0.0, 0.0, 0.0, null, null, "arm64", "admin", "logserver"));
tester.maintain();
assertEquals("2 provisioned hosts",
@@ -288,10 +288,12 @@ public class HostCapacityMaintainerTest {
new ClusterCapacity(1, resources1.vcpu(), resources1.memoryGb(), resources1.diskGb(),
resources1.bandwidthGbps(), resources1.diskSpeed().name(),
resources1.storageType().name(), resources1.architecture().name(),
- "container"),
+ "container",
+ null),
new ClusterCapacity(1, resources1.vcpu(), resources1.memoryGb(), resources1.diskGb(),
resources1.bandwidthGbps(), resources1.diskSpeed().name(),
resources1.storageType().name(), resources1.architecture().name(),
+ null,
null));
tester.flagSource.withBooleanFlag(Flags.MAKE_EXCLUSIVE.id(), true);
tester.maintain();
@@ -329,7 +331,7 @@ public class HostCapacityMaintainerTest {
new ClusterCapacity(1, resources1.vcpu(), resources1.memoryGb(), resources1.diskGb(),
resources1.bandwidthGbps(), resources1.diskSpeed().name(),
resources1.storageType().name(), resources1.architecture().name(),
- null));
+ null, null));
tester.flagSource.withJacksonFlag(PermanentFlags.SHARED_HOST.id(),
new SharedHost(List.of(new HostResources(48d, 128d, 200d, 20d, "fast", "remote", null, 4, "x86_64"))),
SharedHost.class);
@@ -366,7 +368,7 @@ public class HostCapacityMaintainerTest {
new ClusterCapacity(2, resources1.vcpu(), resources1.memoryGb(), resources1.diskGb(),
resources1.bandwidthGbps(), resources1.diskSpeed().name(),
resources1.storageType().name(), resources1.architecture().name(),
- null));
+ null, null));
tester.maintain();
// Hosts are provisioned
@@ -384,7 +386,7 @@ public class HostCapacityMaintainerTest {
tester.assertNodesUnchanged();
// Must be able to allocate 2 nodes with "no resource requirement"
- setPreprovisionCapacityFlag(tester, new ClusterCapacity(2, 0.0, 0.0, 0.0, 0.0, null, null, null, null));
+ setPreprovisionCapacityFlag(tester, new ClusterCapacity(2, 0.0, 0.0, 0.0, 0.0, null, null, null, null, null));
// Next maintenance run does nothing
tester.assertNodesUnchanged();
@@ -407,7 +409,7 @@ public class HostCapacityMaintainerTest {
tester.assertNodesUnchanged();
// Increasing the capacity provisions additional hosts
- setPreprovisionCapacityFlag(tester, new ClusterCapacity(3, 0.0, 0.0, 0.0, 0.0, null, null, null, null));
+ setPreprovisionCapacityFlag(tester, new ClusterCapacity(3, 0.0, 0.0, 0.0, 0.0, null, null, null, null, null));
assertEquals(0, tester.provisionedHostsMatching(sharedHostNodeResources));
assertTrue(node("host102").isEmpty());
tester.maintain();
@@ -427,6 +429,7 @@ public class HostCapacityMaintainerTest {
resources1.diskSpeed().name(),
resources1.storageType().name(),
resources1.architecture().name(),
+ null,
null));
tester.assertNodesUnchanged();
@@ -440,6 +443,7 @@ public class HostCapacityMaintainerTest {
resources1.diskSpeed().name(),
resources1.storageType().name(),
resources1.architecture().name(),
+ null,
null));
assertEquals(1, tester.provisionedHostsMatching(sharedHostNodeResources));