diff options
author | Jon Bratseth <bratseth@gmail.com> | 2023-01-30 13:37:46 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2023-01-30 13:37:46 +0100 |
commit | 93f51338fc01090e84aa0126f9671979255350b1 (patch) | |
tree | 36afa1160e95df0890ed73d22aaf0d0b0c9e6e0e /controller-api | |
parent | 4737f68f2ca971b8eed75f08bf91d0ccd4e086b6 (diff) |
Serialize groupSize if set
Diffstat (limited to 'controller-api')
3 files changed, 40 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java index b7a71cc7b91..788c1ea878b 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java @@ -3,6 +3,7 @@ package com.yahoo.vespa.hosted.controller.api.integration.configserver; import com.yahoo.config.provision.ClusterResources; import com.yahoo.config.provision.ClusterSpec; +import com.yahoo.config.provision.IntRange; import java.time.Duration; import java.time.Instant; @@ -19,6 +20,7 @@ public class Cluster { private final ClusterSpec.Type type; private final ClusterResources min; private final ClusterResources max; + private final IntRange groupSize; private final ClusterResources current; private final Autoscaling target; private final Autoscaling suggested; @@ -29,6 +31,7 @@ public class Cluster { ClusterSpec.Type type, ClusterResources min, ClusterResources max, + IntRange groupSize, ClusterResources current, Autoscaling target, Autoscaling suggested, @@ -38,6 +41,7 @@ public class Cluster { this.type = type; this.min = min; this.max = max; + this.groupSize = groupSize; this.current = current; this.target = target; this.suggested = suggested; @@ -53,6 +57,8 @@ public class Cluster { public ClusterResources max() { return max; } + public IntRange groupSize() { return groupSize; } + public ClusterResources current() { return current; } public Autoscaling target() { return target; } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterData.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterData.java index 539f0545c88..324836ccb93 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterData.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterData.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.yahoo.config.provision.ClusterSpec; +import com.yahoo.config.provision.IntRange; import com.yahoo.vespa.hosted.controller.api.integration.configserver.Cluster; import java.time.Duration; @@ -28,6 +29,9 @@ public class ClusterData { @JsonProperty("max") public ClusterResourcesData max; + @JsonProperty("groupSize") + public IntRangeData groupSize; + @JsonProperty("current") public ClusterResourcesData current; @@ -48,6 +52,7 @@ public class ClusterData { ClusterSpec.Type.from(type), min.toClusterResources(), max.toClusterResources(), + groupSize == null ? IntRange.empty() : groupSize.toRange(), current.toClusterResources(), target == null ? Cluster.Autoscaling.empty() : target.toAutoscaling(), suggested == null ? Cluster.Autoscaling.empty() : suggested.toAutoscaling(), diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/IntRangeData.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/IntRangeData.java new file mode 100644 index 00000000000..7d31448a756 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/IntRangeData.java @@ -0,0 +1,29 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.integration.noderepository; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.yahoo.config.provision.IntRange; + +import java.util.OptionalInt; + +/** + * @author bratseth + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class IntRangeData { + + @JsonProperty("from") + public Integer from; + + @JsonProperty("to") + public Integer to; + + public IntRange toRange() { + return new IntRange(from == null ? OptionalInt.empty() : OptionalInt.of(from), + to == null ? OptionalInt.empty() : OptionalInt.of(to)); + } + +} |