diff options
author | Harald Musum <musum@yahooinc.com> | 2022-02-24 20:04:05 +0100 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2022-02-24 20:04:05 +0100 |
commit | 9c57850a659502c01c8bfdd79178bb64ec390d58 (patch) | |
tree | a80094b9f15eb42a15ddff2061f247090922b13c /controller-api/src | |
parent | a98992913056dda35c44558b9cc3fd865296ecc3 (diff) |
Add architeecture to node repo rest api
Diffstat (limited to 'controller-api/src')
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeResources.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeResources.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeResources.java index 2673e855751..ccd1a9a745b 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeResources.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeResources.java @@ -24,6 +24,8 @@ public class NodeResources { private String diskSpeed; @JsonProperty private String storageType; + @JsonProperty + private String architecture = "x86_64"; // TODO: Remove default value for architecture public Double getVcpu() { return vcpu; @@ -73,10 +75,19 @@ public class NodeResources { this.storageType = storageType; } + public String getArchitecture() { + return architecture; + } + + public void setArchitecture(String architecture) { + this.architecture = architecture; + } + public com.yahoo.config.provision.NodeResources toNodeResources() { return new com.yahoo.config.provision.NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, toDiskSpeed(diskSpeed), - toStorageType(storageType)); + toStorageType(storageType), + toArchitecture(architecture)); } private com.yahoo.config.provision.NodeResources.DiskSpeed toDiskSpeed(String diskSpeed) { @@ -97,6 +108,15 @@ public class NodeResources { } } + private com.yahoo.config.provision.NodeResources.Architecture toArchitecture(String architecture) { + switch (architecture) { + case "arm64" : return com.yahoo.config.provision.NodeResources.Architecture.arm64; + case "x86_64" : return com.yahoo.config.provision.NodeResources.Architecture.x86_64; + case "any" : return com.yahoo.config.provision.NodeResources.Architecture.any; + default : throw new IllegalArgumentException("Unknown architecture '" + architecture + "'"); + } + } + @Override public String toString() { return "NodeResources{" + @@ -106,6 +126,7 @@ public class NodeResources { ", bandwidthGbps=" + bandwidthGbps + ", diskSpeed='" + diskSpeed + '\'' + ", storageType='" + storageType + '\'' + + ", architecture='" + architecture + '\'' + '}'; } } |