diff options
author | Øyvind Grønnesby <oyving@verizonmedia.com> | 2021-03-16 21:14:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 21:14:59 +0100 |
commit | 4632ccb8afb788dd5cf19e6137391637bc796d61 (patch) | |
tree | c6c8bf3525698a8184fde1b5439a24744970512d | |
parent | 6699b03fcb353d0ba19910421b959bfc879294f8 (diff) | |
parent | d75cce887d829ae1978ee728d268efcb1302e6f3 (diff) |
Merge pull request #16985 from vespa-engine/ogronnesby/remove-admin-from-quota
Remove the admin from quota usage we calculate in controller
2 files changed, 3 insertions, 1 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculator.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculator.java index de57f1a5676..c17530fd9e2 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculator.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculator.java @@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.controller.application; import com.yahoo.config.application.api.DeploymentSpec; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterResources; +import com.yahoo.config.provision.ClusterSpec; import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.api.integration.billing.Quota; @@ -36,6 +37,7 @@ public class DeploymentQuotaCalculator { // correctly we retrieve the maximum of .current() and .max() - otherwise we would keep adding 0s for those // that are not using autoscaling. var quotaUsageRate = application.clusters().values().stream() + .filter(cluster -> ! cluster.type().equals(ClusterSpec.Type.admin)) .map(cluster -> largestQuotaUsage(cluster.current(), cluster.max())) .mapToDouble(resources -> resources.nodes() * resources.nodeResources().cost()) .sum(); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculatorTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculatorTest.java index 28bbeb63caa..737807b5dd3 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculatorTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculatorTest.java @@ -72,7 +72,7 @@ public class DeploymentQuotaCalculatorTest { var mapper = new ObjectMapper(); var application = mapper.readValue(content, ApplicationData.class).toApplication(); var usage = DeploymentQuotaCalculator.calculateQuotaUsage(application); - assertEquals(1.164, usage.rate(), 0.001); + assertEquals(1.068, usage.rate(), 0.001); } @Test |