aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2022-05-12 15:48:22 +0200
committerMartin Polden <mpolden@mpolden.no>2022-05-13 14:46:35 +0200
commit8327b0e89d21a7122019a3e342baa880f23a9898 (patch)
tree0758c28acec995475a406a1dba21e7affabd008f /config-model/src/main/java/com/yahoo
parentc8671df2c8ca29a037e148f758e6092be6a6128c (diff)
Use cloud account from model in host provisioning
Diffstat (limited to 'config-model/src/main/java/com/yahoo')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java31
1 files changed, 22 insertions, 9 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
index 71d325adb7d..640bede6b62 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
@@ -6,6 +6,7 @@ import com.yahoo.component.Version;
import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.config.model.ConfigModelContext;
import com.yahoo.config.provision.Capacity;
+import com.yahoo.config.provision.CloudAccount;
import com.yahoo.config.provision.ClusterMembership;
import com.yahoo.config.provision.ClusterResources;
import com.yahoo.config.provision.ClusterSpec;
@@ -56,12 +57,16 @@ public class NodesSpecification {
/** The ID of the cluster referencing this node specification, if any */
private final Optional<String> combinedId;
+ /** The cloud account to use for nodes in this spec, if any */
+ private final Optional<CloudAccount> cloudAccount;
+
private NodesSpecification(ClusterResources min,
ClusterResources max,
boolean dedicated, Version version,
boolean required, boolean canFail, boolean exclusive,
Optional<DockerImage> dockerImageRepo,
- Optional<String> combinedId) {
+ Optional<String> combinedId,
+ Optional<CloudAccount> cloudAccount) {
if (max.smallerThan(min))
throw new IllegalArgumentException("Min resources must be larger or equal to max resources, but " +
max + " is smaller than " + min);
@@ -83,10 +88,12 @@ public class NodesSpecification {
this.exclusive = exclusive;
this.dockerImageRepo = dockerImageRepo;
this.combinedId = combinedId;
+ this.cloudAccount = cloudAccount;
}
private static NodesSpecification create(boolean dedicated, boolean canFail, Version version,
- ModelElement nodesElement, Optional<DockerImage> dockerImageRepo) {
+ ModelElement nodesElement, Optional<DockerImage> dockerImageRepo,
+ Optional<CloudAccount> cloudAccount) {
var resolvedElement = resolveElement(nodesElement);
var combinedId = findCombinedId(nodesElement, resolvedElement);
var resources = toResources(resolvedElement);
@@ -98,7 +105,8 @@ public class NodesSpecification {
canFail,
resolvedElement.booleanAttribute("exclusive", false),
dockerImageToUse(resolvedElement, dockerImageRepo),
- combinedId);
+ combinedId,
+ cloudAccount);
}
private static Pair<ClusterResources, ClusterResources> toResources(ModelElement nodesElement) {
@@ -125,7 +133,8 @@ public class NodesSpecification {
! context.getDeployState().getProperties().isBootstrap(),
context.getDeployState().getWantedNodeVespaVersion(),
nodesElement,
- context.getDeployState().getWantedDockerImageRepo());
+ context.getDeployState().getWantedDockerImageRepo(),
+ context.getDeployState().getProperties().cloudAccount());
}
/**
@@ -154,7 +163,8 @@ public class NodesSpecification {
! context.getDeployState().getProperties().isBootstrap(),
context.getDeployState().getWantedNodeVespaVersion(),
nodesElement,
- context.getDeployState().getWantedDockerImageRepo()));
+ context.getDeployState().getWantedDockerImageRepo(),
+ context.getDeployState().getProperties().cloudAccount()));
}
/**
@@ -169,7 +179,8 @@ public class NodesSpecification {
! context.getDeployState().getProperties().isBootstrap(),
false,
context.getDeployState().getWantedDockerImageRepo(),
- Optional.empty());
+ Optional.empty(),
+ context.getDeployState().getProperties().cloudAccount());
}
/** Returns a requirement from <code>count</code> dedicated nodes in one group */
@@ -182,7 +193,8 @@ public class NodesSpecification {
! context.getDeployState().getProperties().isBootstrap(),
false,
context.getDeployState().getWantedDockerImageRepo(),
- Optional.empty());
+ Optional.empty(),
+ context.getDeployState().getProperties().cloudAccount());
}
/**
@@ -206,7 +218,8 @@ public class NodesSpecification {
! context.getDeployState().getProperties().isBootstrap(),
false,
context.getDeployState().getWantedDockerImageRepo(),
- Optional.empty());
+ Optional.empty(),
+ context.getDeployState().getProperties().cloudAccount());
}
public ClusterResources minResources() { return min; }
@@ -239,7 +252,7 @@ public class NodesSpecification {
.dockerImageRepository(dockerImageRepo)
.stateful(stateful)
.build();
- return hostSystem.allocateHosts(cluster, Capacity.from(min, max, required, canFail), logger);
+ return hostSystem.allocateHosts(cluster, Capacity.from(min, max, required, canFail, cloudAccount), logger);
}
private static Pair<NodeResources, NodeResources> nodeResources(ModelElement nodesElement) {