summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorØyvind Grønnesby <oyving@yahooinc.com>2022-08-08 10:25:24 +0200
committerØyvind Grønnesby <oyving@yahooinc.com>2022-08-08 10:25:24 +0200
commit9be856b67a89ae715639aea6528406323472326d (patch)
treea7512554645b082a379cdd8596a054d6a72fac81 /controller-server
parente0744af00929a345a481a2f8a2e086b61bd53f55 (diff)
Remove quota from tenant resource
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java12
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-with-keys.json4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-with-secrets.json4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-without-applications.json4
4 files changed, 5 insertions, 19 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
index 159bfb08b33..8d2fac84bc0 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
@@ -2558,12 +2558,11 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
cloudTenant.tenantSecretStores());
try {
- var tenantQuota = controller.serviceRegistry().billingController().getQuota(tenant.name());
var usedQuota = applications.stream()
.map(Application::quotaUsage)
.reduce(QuotaUsage.none, QuotaUsage::add);
- toSlime(tenantQuota, usedQuota, object.setObject("quota"));
+ toSlime(object.setObject("quota"), usedQuota);
} catch (Exception e) {
log.warning(String.format("Failed to get quota for tenant %s: %s", tenant.name(), Exceptions.toMessageString(e)));
}
@@ -2606,15 +2605,8 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
archiveAccess.gcpMember().ifPresent(member -> object.setString("gcpMember", member));
}
- private void toSlime(Quota quota, QuotaUsage usage, Cursor object) {
- quota.budget().ifPresentOrElse(
- budget -> object.setDouble("budget", budget.doubleValue()),
- () -> object.setNix("budget")
- );
+ private void toSlime(Cursor object, QuotaUsage usage) {
object.setDouble("budgetUsed", usage.rate());
-
- // TODO: Retire when we no longer use maxClusterSize as a meaningful limit
- quota.maxClusterSize().ifPresent(maxClusterSize -> object.setLong("clusterSize", maxClusterSize));
}
private void toSlime(ClusterResources resources, Cursor object) {
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-with-keys.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-with-keys.json
index f980f9231f3..6b78bfda6c4 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-with-keys.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-with-keys.json
@@ -20,9 +20,7 @@
}
},
"quota": {
- "budget": null,
- "budgetUsed": 0.0,
- "clusterSize": 5
+ "budgetUsed": 0.0
},
"archiveAccess": { },
"applications": [
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-with-secrets.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-with-secrets.json
index 1152033791b..8c3bcc041d6 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-with-secrets.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-with-secrets.json
@@ -28,9 +28,7 @@
}
},
"quota": {
- "budget": null,
- "budgetUsed": 0.0,
- "clusterSize": 5
+ "budgetUsed": 0.0
},
"archiveAccess": { },
"applications": [
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-without-applications.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-without-applications.json
index 631346181a1..694e886a876 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-without-applications.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/responses/tenant-without-applications.json
@@ -11,9 +11,7 @@
}
},
"quota": {
- "budget": null,
- "budgetUsed": 0.0,
- "clusterSize": 5
+ "budgetUsed": 0.0
},
"archiveAccess": { },
"applications": [ ],