aboutsummaryrefslogtreecommitdiffstats
path: root/flags
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2024-05-19 14:12:41 +0200
committerGitHub <noreply@github.com>2024-05-19 14:12:41 +0200
commitcbb09179e61b54c568ed9976194402e935977946 (patch)
tree464cf634df5a326f7065a6d6a226a1154d8a6fd2 /flags
parentdbd26dbe414187f6f5acbd18785549d9ced2a281 (diff)
parent12ea6e856952196c38fc47f6b9318900a046f2a0 (diff)
Merge pull request #31241 from vespa-engine/hakonhall/quota-capacity-policies
Hakonhall/quota capacity policies
Diffstat (limited to 'flags')
-rw-r--r--flags/pom.xml6
-rw-r--r--flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java14
2 files changed, 15 insertions, 5 deletions
diff --git a/flags/pom.xml b/flags/pom.xml
index 9f3a9d35831..38e946a62e8 100644
--- a/flags/pom.xml
+++ b/flags/pom.xml
@@ -44,6 +44,12 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>config-provisioning</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>provided</scope>
diff --git a/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java b/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java
index 66356d979a4..3f229862d7a 100644
--- a/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java
+++ b/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java
@@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
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.SharedHosts;
import com.yahoo.vespa.flags.PermanentFlags;
import java.util.List;
@@ -19,7 +21,7 @@ import java.util.Objects;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(value = JsonInclude.Include.NON_NULL)
-public class SharedHost {
+public class SharedHost implements SharedHosts {
private final List<HostResources> resources;
@@ -43,14 +45,16 @@ public class SharedHost {
/** Whether there are any shared hosts specifically for the given cluster type, or without a cluster type restriction. */
@JsonIgnore
- public boolean supportsClusterType(String clusterType) {
- return resources.stream().anyMatch(resource -> resource.clusterType().map(clusterType::equalsIgnoreCase).orElse(true));
+ @Override
+ public boolean supportsClusterType(ClusterSpec.Type clusterType) {
+ return resources.stream().anyMatch(resource -> resource.clusterType().map(type -> clusterType.name().equalsIgnoreCase(type)).orElse(true));
}
/** Whether there are any shared hosts specifically for the given cluster type. */
@JsonIgnore
- public boolean hasClusterType(String clusterType) {
- return resources.stream().anyMatch(resource -> resource.clusterType().map(clusterType::equalsIgnoreCase).orElse(false));
+ @Override
+ public boolean hasClusterType(ClusterSpec.Type clusterType) {
+ return resources.stream().anyMatch(resource -> resource.clusterType().map(type -> clusterType.name().equalsIgnoreCase(type)).orElse(false));
}
@JsonIgnore