summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorValerij Fredriksen <freva@users.noreply.github.com>2023-01-30 14:20:24 +0100
committerGitHub <noreply@github.com>2023-01-30 14:20:24 +0100
commit95f818672cd7b5e3144ac632d191f221f0b49962 (patch)
tree403c35b28ac07220169db04c32bbd4948d2f7794 /controller-api
parentb229fe2920007ae37b87fe0b10e52ed7ef68949b (diff)
parent93f51338fc01090e84aa0126f9671979255350b1 (diff)
Merge pull request #25799 from vespa-engine/bratseth/groupsize-in-application-v4
Serialize groupSize if set
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java6
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ClusterData.java5
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/IntRangeData.java29
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));
+ }
+
+}