diff options
author | Øyvind Grønnesby <oyving@yahooinc.com> | 2023-03-28 06:27:04 -0700 |
---|---|---|
committer | Øyvind Grønnesby <oyving@yahooinc.com> | 2023-03-28 06:27:04 -0700 |
commit | 1e8cf546bfa39d23c672350cf44b75b2ea4f23ee (patch) | |
tree | 2f289f1f9887608c0ca1a12a8123b592a6a0d68d /controller-server | |
parent | 49d4352d9fb20a213b62ee19ffef5098f9900a56 (diff) | |
parent | c2634969650aec3c3f3744fd2069a4b5b58945ca (diff) |
Merge remote-tracking branch 'origin/master' into ogronnesby/gpu-billing
Diffstat (limited to 'controller-server')
21 files changed, 109 insertions, 65 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ApplicationPackageValidator.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ApplicationPackageValidator.java index 842d99abe71..bd42587576d 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ApplicationPackageValidator.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ApplicationPackageValidator.java @@ -225,14 +225,15 @@ public class ApplicationPackageValidator { oldEndpoint.allowedUrns().stream().map(AllowedUrn::toString).collect(joining(", ", "[", "]")) + ", but does not include all these in the new deployment spec. " + "Deploying with the new settings will allow access to " + - (newEndpoint.allowedUrns().isEmpty() ? "no one" : newEndpoint.allowedUrns().stream().map(AllowedUrn::toString).collect(joining(", ", "[", "]")))); + (newEndpoint.allowedUrns().isEmpty() ? "no one" : newEndpoint.allowedUrns().stream().map(AllowedUrn::toString).collect(joining(", ", "[", "]")) + + ". " + ValidationOverrides.toAllowMessage(validationId))); }); newEndpoints.forEach((cluster, newEndpoint) -> { ZoneEndpoint oldEndpoint = oldEndpoints.getOrDefault(cluster, ZoneEndpoint.defaultEndpoint); if (oldEndpoint.isPublicEndpoint() && ! newEndpoint.isPublicEndpoint()) throw new IllegalArgumentException(prefix + "has a public endpoint for cluster '" + cluster.value() + "' in '" + zone.region().get().value() + "', but the new deployment spec " + - "disables this"); + "disables this. " + ValidationOverrides.toAllowMessage(validationId)); }); }); } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java index 9721396cd54..451f5555eb2 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java @@ -1,7 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.deployment; -import ai.vespa.http.DomainName; import ai.vespa.http.HttpURL; import com.yahoo.component.Version; import com.yahoo.config.application.api.DeploymentSpec; @@ -249,7 +248,7 @@ public class InternalStepRunner implements StepRunner { } case LOAD_BALANCER_NOT_READY, PARENT_HOST_NOT_READY -> { logger.log(e.message()); // Consider splitting these messages in summary and details, on config server. - Instant someTimeAfterStart = startTime.plusSeconds(450); + Instant someTimeAfterStart = startTime.plusSeconds(200); Instant inALittleWhile = controller.clock().instant().plusSeconds(90); controller.jobController().locked(id, run -> run.sleepingUntil(someTimeAfterStart.isAfter(inALittleWhile) ? someTimeAfterStart : inALittleWhile)); return result; diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudDatabaseMaintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudDatabaseMaintainer.java new file mode 100644 index 00000000000..914707aa318 --- /dev/null +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudDatabaseMaintainer.java @@ -0,0 +1,26 @@ +package com.yahoo.vespa.hosted.controller.maintenance; + +import com.yahoo.vespa.hosted.controller.Controller; +import com.yahoo.vespa.hosted.controller.tenant.Tenant; +import com.yahoo.yolean.Exceptions; + +import java.time.Duration; + +public class CloudDatabaseMaintainer extends ControllerMaintainer { + + public CloudDatabaseMaintainer(Controller controller, Duration interval) { + super(controller, interval); + } + + @Override + protected double maintain() { + try { + var tenants = controller().tenants().asList().stream().map(Tenant::name).toList(); + controller().serviceRegistry().billingController().updateCache(tenants); + } catch (Exception e) { + log.warning("Could not update cloud database cache: " + Exceptions.toMessageString(e)); + return 0.0; + } + return 1.0; + } +} diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ControllerMaintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ControllerMaintainer.java index 4e6eda9f0fa..c861d522818 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ControllerMaintainer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ControllerMaintainer.java @@ -21,8 +21,6 @@ import java.util.logging.Logger; */ public abstract class ControllerMaintainer extends Maintainer { - protected static final Logger log = Logger.getLogger(ControllerMaintainer.class.getName()); - private final Controller controller; /** The systems in which this maintainer should run */ diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ControllerMaintenance.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ControllerMaintenance.java index bcc8296da2a..05159b38ec6 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ControllerMaintenance.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ControllerMaintenance.java @@ -75,6 +75,7 @@ public class ControllerMaintenance extends AbstractComponent { maintainers.add(new TenantRoleCleanupMaintainer(controller, intervals.tenantRoleMaintainer)); maintainers.add(new ChangeRequestMaintainer(controller, intervals.changeRequestMaintainer)); maintainers.add(new VcmrMaintainer(controller, intervals.vcmrMaintainer, metric)); + maintainers.add(new CloudDatabaseMaintainer(controller, intervals.defaultInterval)); maintainers.add(new CloudTrialExpirer(controller, intervals.defaultInterval)); maintainers.add(new RetriggerMaintainer(controller, intervals.retriggerMaintainer)); maintainers.add(new UserManagementMaintainer(controller, intervals.userManagementMaintainer, controller.serviceRegistry().roleMaintainer())); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/EnclaveAccessMaintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/EnclaveAccessMaintainer.java index bce4abcb14b..7af96d10f2f 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/EnclaveAccessMaintainer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/EnclaveAccessMaintainer.java @@ -17,16 +17,15 @@ public class EnclaveAccessMaintainer extends ControllerMaintainer { private static final Logger logger = Logger.getLogger(EnclaveAccessMaintainer.class.getName()); EnclaveAccessMaintainer(Controller controller, Duration interval) { - super(controller, interval, null, Set.of(SystemName.PublicCd)); + super(controller, interval, null, Set.of(SystemName.PublicCd, SystemName.Public)); } @Override protected double maintain() { try { return controller().serviceRegistry().enclaveAccessService().allowAccessFor(externalAccounts()); - } - catch (RuntimeException e) { - logger.log(WARNING, "Failed sharing AMIs", e); + } catch (RuntimeException e) { + logger.log(WARNING, "Failed sharing resources with enclave", e); return 0; } } @@ -39,5 +38,4 @@ public class EnclaveAccessMaintainer extends ControllerMaintainer { return accounts; } - } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainer.java index 26edd210075..3f20c2eac8f 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainer.java @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.maintenance; +import com.yahoo.component.Version; import com.yahoo.concurrent.UncheckedTimeoutException; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterResources; @@ -290,7 +291,7 @@ public class ResourceMeterMaintainer extends ControllerMaintainer { (Node node) -> node.resources().architecture(), Collectors.collectingAndThen( Collectors.groupingBy( - (Node node) -> node.currentVersion().getMajor(), + (Node node) -> node.wantedVersion().getMajor(), Collectors.toList()), convertNodeListToResourceSnapshot(zoneId))); } 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 b1df25c933b..6c614738ddf 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 @@ -57,7 +57,7 @@ import com.yahoo.vespa.hosted.controller.Instance; import com.yahoo.vespa.hosted.controller.LockedTenant; import com.yahoo.vespa.hosted.controller.NotExistsException; import com.yahoo.vespa.hosted.controller.api.application.v4.EnvironmentResource; -import com.yahoo.vespa.hosted.controller.api.application.v4.model.ProtonMetrics; +import com.yahoo.vespa.hosted.controller.api.application.v4.model.SearchNodeMetrics; import com.yahoo.vespa.hosted.controller.api.identifiers.ClusterId; import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; import com.yahoo.vespa.hosted.controller.api.identifiers.TenantId; @@ -286,7 +286,9 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler { if (path.matches("/application/v4/tenant/{tenant}/application/{application}/instance/{instance}/environment/{environment}/region/{region}/access/support")) return supportAccess(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"), request.propertyMap()); if (path.matches("/application/v4/tenant/{tenant}/application/{application}/instance/{instance}/environment/{environment}/region/{region}/node/{node}/service-dump")) return getServiceDump(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"), path.get("node"), request); if (path.matches("/application/v4/tenant/{tenant}/application/{application}/instance/{instance}/environment/{environment}/region/{region}/scaling")) return scaling(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"), request); - if (path.matches("/application/v4/tenant/{tenant}/application/{application}/environment/{environment}/region/{region}/instance/{instance}/metrics")) return metrics(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region")); + // TODO: Remove when not used anymore (migrated to ../metrics/searchnode) + if (path.matches("/application/v4/tenant/{tenant}/application/{application}/environment/{environment}/region/{region}/instance/{instance}/metrics")) return searchNodeMetrics(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region")); + if (path.matches("/application/v4/tenant/{tenant}/application/{application}/environment/{environment}/region/{region}/instance/{instance}/metrics/searchnode")) return searchNodeMetrics(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region")); if (path.matches("/application/v4/tenant/{tenant}/application/{application}/instance/{instance}/environment/{environment}/region/{region}/global-rotation")) return rotationStatus(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"), Optional.ofNullable(request.getProperty("endpointId"))); if (path.matches("/application/v4/tenant/{tenant}/application/{application}/instance/{instance}/environment/{environment}/region/{region}/global-rotation/override")) return getGlobalRotationOverride(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region")); if (path.matches("/application/v4/tenant/{tenant}/application/{application}/environment/{environment}/region/{region}/instance/{instance}")) return deployment(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"), request); @@ -1461,12 +1463,12 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler { return new SlimeJsonResponse(SupportAccessSerializer.serializeCurrentState(disallowed, controller.clock().instant())); } - private HttpResponse metrics(String tenantName, String applicationName, String instanceName, String environment, String region) { + private HttpResponse searchNodeMetrics(String tenantName, String applicationName, String instanceName, String environment, String region) { ApplicationId application = ApplicationId.from(tenantName, applicationName, instanceName); ZoneId zone = requireZone(environment, region); DeploymentId deployment = new DeploymentId(application, zone); - List<ProtonMetrics> protonMetrics = controller.serviceRegistry().configServer().getProtonMetrics(deployment); - return buildResponseFromProtonMetrics(protonMetrics); + List<SearchNodeMetrics> searchNodeMetrics = controller.serviceRegistry().configServer().getSearchNodeMetrics(deployment); + return buildResponseFromSearchNodeMetrics(searchNodeMetrics); } private HttpResponse scaling(String tenantName, String applicationName, String instanceName, String environment, String region, HttpRequest request) { @@ -1492,11 +1494,11 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler { return new SlimeJsonResponse(slime); } - private JsonResponse buildResponseFromProtonMetrics(List<ProtonMetrics> protonMetrics) { + private JsonResponse buildResponseFromSearchNodeMetrics(List<SearchNodeMetrics> searchnodeMetrics) { try { var jsonObject = jsonMapper.createObjectNode(); var jsonArray = jsonMapper.createArrayNode(); - for (ProtonMetrics metrics : protonMetrics) { + for (SearchNodeMetrics metrics : searchnodeMetrics) { jsonArray.add(metrics.toJson()); } jsonObject.set("metrics", jsonArray); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandler.java index 3c832dc8873..caead4de03d 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandler.java @@ -38,7 +38,8 @@ public class ConfigServerApiHandler extends AuditLoggingRequestHandler { private static final URI CONTROLLER_URI = URI.create("https://localhost:4443/"); private static final List<HttpURL.Path> WHITELISTED_APIS = List.of(parse("/flags/v1/"), parse("/nodes/v2/"), - parse("/orchestrator/v1/")); + parse("/orchestrator/v1/"), + parse("/state/v1/")); private final ZoneRegistry zoneRegistry; private final ConfigServerRestExecutor proxy; diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/MeteringResponse.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/MeteringResponse.java index 7df216d6c9c..ea7bce00794 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/MeteringResponse.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/MeteringResponse.java @@ -26,13 +26,16 @@ public class MeteringResponse extends SlimeJsonResponse { List<ResourceSnapshot> snapshots = resourceClient.getRawSnapshotHistoryForTenant(TenantName.from(tenantName), YearMonth.parse(month)); snapshots.forEach(snapshot -> { Cursor object = root.addObject(); - object.setString("applicationId", snapshot.getApplicationId().toShortString()); + object.setString("applicationId", snapshot.getApplicationId().toFullString()); object.setLong("timestamp", snapshot.getTimestamp().toEpochMilli()); object.setString("zoneId", snapshot.getZoneId().value()); object.setDouble("cpu", snapshot.resources().vcpu()); object.setDouble("memory", snapshot.resources().memoryGb()); object.setDouble("disk", snapshot.resources().diskGb()); object.setString("architecture", snapshot.resources().architecture().name()); + object.setLong("version", snapshot.getMajorVersion()); + object.setDouble("gpuMemoryGb", snapshot.resources().gpuResources().memoryGb()); + object.setLong("gpuCount", snapshot.resources().gpuResources().count()); }); return slime; } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiHandler.java index a9787e28113..3811ec22555 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiHandler.java @@ -368,9 +368,8 @@ public class UserApiHandler extends ThreadedHttpRequestHandler { private boolean hasTrialCapacity() { if (! controller.system().isPublic()) return true; - var existing = controller.tenants().asList().stream().map(Tenant::name).toList(); - var trialTenants = controller.serviceRegistry().billingController().tenantsWithPlan(existing, PlanId.from("trial")); - return maxTrialTenants.value() < 0 || trialTenants.size() < maxTrialTenants.value(); + var plan = controller.serviceRegistry().planRegistry().plan("trial"); + return controller.serviceRegistry().billingController().tenantsWithPlanUnderLimit(plan.get(), maxTrialTenants.value()); } private static Inspector bodyInspector(HttpRequest request) { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java index a049b614e25..8f0536480f5 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java @@ -1128,7 +1128,10 @@ public class ControllerTest { </prod> </deployment>""")); - assertEquals("zone-endpoint-change: application 'tenant.application' has a public endpoint for cluster 'foo' in 'us-east-3', but the new deployment spec disables this", + assertEquals("zone-endpoint-change: application 'tenant.application' has a public endpoint for " + + "cluster 'foo' in 'us-east-3', but the new deployment spec disables this. " + + "To allow this add <allow until='yyyy-mm-dd'>zone-endpoint-change</allow> to validation-overrides.xml, " + + "see https://docs.vespa.ai/en/reference/validation-overrides.html", assertThrows(IllegalArgumentException.class, () -> app.submit(ApplicationPackageBuilder.fromDeploymentXml(""" <deployment> @@ -1168,9 +1171,12 @@ public class ControllerTest { ValidationId.zoneEndpointChange)); // Changing URNs is guarded. - assertEquals("zone-endpoint-change: application 'tenant.application' allows access to cluster 'foo' in 'us-east-3' to " + - "['yarn' through 'aws-private-link'], but does not include all these in the new deployment spec. " + - "Deploying with the new settings will allow access to ['yarn' through 'gcp-service-connect']", + assertEquals("zone-endpoint-change: application 'tenant.application' allows access to cluster " + + "'foo' in 'us-east-3' to ['yarn' through 'aws-private-link'], " + + "but does not include all these in the new deployment spec. " + + "Deploying with the new settings will allow access to ['yarn' through 'gcp-service-connect']. " + + "To allow this add <allow until='yyyy-mm-dd'>zone-endpoint-change</allow> to validation-overrides.xml, " + + "see https://docs.vespa.ai/en/reference/validation-overrides.html", assertThrows(IllegalArgumentException.class, () -> app.submit(ApplicationPackageBuilder.fromDeploymentXml(""" <deployment> diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java index 338e3aba643..d542c06b5bf 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java @@ -6,7 +6,6 @@ import ai.vespa.http.HttpURL.Path; import ai.vespa.http.HttpURL.Query; import com.yahoo.component.AbstractComponent; import com.yahoo.component.Version; -import com.yahoo.component.annotation.Inject; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.CloudAccount; import com.yahoo.config.provision.ClusterResources; @@ -22,12 +21,11 @@ import com.yahoo.config.provision.NodeType; import com.yahoo.config.provision.ZoneEndpoint.AllowedUrn; import com.yahoo.config.provision.ZoneEndpoint.AccessType; import com.yahoo.config.provision.zone.ZoneId; -import com.yahoo.rdl.UUID; import com.yahoo.vespa.flags.json.FlagData; import com.yahoo.vespa.hosted.controller.api.application.v4.model.ClusterMetrics; import com.yahoo.vespa.hosted.controller.api.application.v4.model.DeploymentData; import com.yahoo.vespa.hosted.controller.api.application.v4.model.EndpointStatus; -import com.yahoo.vespa.hosted.controller.api.application.v4.model.ProtonMetrics; +import com.yahoo.vespa.hosted.controller.api.application.v4.model.SearchNodeMetrics; import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; import com.yahoo.vespa.hosted.controller.api.integration.LogEntry; import com.yahoo.vespa.hosted.controller.api.integration.configserver.ApplicationReindexing; @@ -70,7 +68,6 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Random; import java.util.Set; import java.util.function.Consumer; import java.util.function.Supplier; @@ -106,7 +103,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer private final Map<DeploymentId, TestReport> testReport = new HashMap<>(); private final Map<DeploymentId, CloudAccount> cloudAccounts = new HashMap<>(); private final Map<DeploymentId, List<X509Certificate>> additionalCertificates = new HashMap<>(); - private List<ProtonMetrics> protonMetrics; + private List<SearchNodeMetrics> searchnodeMetrics; private Version lastPrepareVersion = null; private Consumer<ApplicationId> prepareException = null; @@ -310,8 +307,8 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer this.clusterMetrics.put(deployment, clusterMetrics); } - public void setProtonMetrics(List<ProtonMetrics> protonMetrics) { - this.protonMetrics = protonMetrics; + public void setProtonMetrics(List<SearchNodeMetrics> searchnodeMetrics) { + this.searchnodeMetrics = searchnodeMetrics; } public void deferLoadBalancerProvisioningIn(Set<Environment> environments) { @@ -511,8 +508,8 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer } @Override - public List<ProtonMetrics> getProtonMetrics(DeploymentId deployment) { - return this.protonMetrics; + public List<SearchNodeMetrics> getSearchNodeMetrics(DeploymentId deployment) { + return this.searchnodeMetrics; } @Override diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java index 998b371bbf1..d80c55fd00a 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java @@ -85,7 +85,7 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg private final MockEnclaveAccessService mockAMIService = new MockEnclaveAccessService(); private final MockResourceTagger mockResourceTagger = new MockResourceTagger(); private final MockRoleService roleService = new MockRoleService(); - private final BillingController billingController = new MockBillingController(clock); + private final MockBillingController billingController = new MockBillingController(clock); private final ArtifactRegistryMock containerRegistry = new ArtifactRegistryMock(); private final NoopTenantSecretService tenantSecretService = new NoopTenantSecretService(); private final NoopEndpointSecretManager secretManager = new NoopEndpointSecretManager(); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainerTest.java index 3034c93e593..8196aa48197 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainerTest.java @@ -61,9 +61,9 @@ public class ResourceMeterMaintainerTest { .collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().cost().getAsDouble()))); List<ResourceSnapshot> resourceSnapshots = List.of( - new ResourceSnapshot(app1, resources(12, 34, 56), Instant.EPOCH, z1, Version.emptyVersion), - new ResourceSnapshot(app1, resources(23, 45, 67), Instant.EPOCH, z2, Version.emptyVersion), - new ResourceSnapshot(app2, resources(34, 56, 78), Instant.EPOCH, z1, Version.emptyVersion)); + new ResourceSnapshot(app1, resources(12, 34, 56), Instant.EPOCH, z1, 0), + new ResourceSnapshot(app1, resources(23, 45, 67), Instant.EPOCH, z2, 0), + new ResourceSnapshot(app2, resources(34, 56, 78), Instant.EPOCH, z1, 0)); maintainer.updateDeploymentCost(resourceSnapshots); assertCost.accept(app1, Map.of(z1, 1.72, z2, 3.05)); @@ -71,9 +71,9 @@ public class ResourceMeterMaintainerTest { // Remove a region from app1 and add region to app2 resourceSnapshots = List.of( - new ResourceSnapshot(app1, resources(23, 45, 67), Instant.EPOCH, z2, Version.emptyVersion), - new ResourceSnapshot(app2, resources(34, 56, 78), Instant.EPOCH, z1, Version.emptyVersion), - new ResourceSnapshot(app2, resources(45, 67, 89), Instant.EPOCH, z2, Version.emptyVersion)); + new ResourceSnapshot(app1, resources(23, 45, 67), Instant.EPOCH, z2, 0), + new ResourceSnapshot(app2, resources(34, 56, 78), Instant.EPOCH, z1, 0), + new ResourceSnapshot(app2, resources(45, 67, 89), Instant.EPOCH, z2, 0)); maintainer.updateDeploymentCost(resourceSnapshots); assertCost.accept(app1, Map.of(z2, 3.05)); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java index 14771906852..9a34989aeff 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java @@ -31,7 +31,7 @@ import com.yahoo.vespa.hosted.controller.ControllerTester; import com.yahoo.vespa.hosted.controller.Instance; import com.yahoo.vespa.hosted.controller.LockedTenant; import com.yahoo.vespa.hosted.controller.api.application.v4.EnvironmentResource; -import com.yahoo.vespa.hosted.controller.api.application.v4.model.ProtonMetrics; +import com.yahoo.vespa.hosted.controller.api.application.v4.model.SearchNodeMetrics; import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; import com.yahoo.vespa.hosted.controller.api.identifiers.Property; import com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId; @@ -1860,20 +1860,20 @@ public class ApplicationApiTest extends ControllerContainerTest { private void updateMetrics() { tester.serviceRegistry().configServerMock().setProtonMetrics(List.of( - (new ProtonMetrics("content/doc/")) - .addMetric(ProtonMetrics.DOCUMENTS_ACTIVE_COUNT, 11430) - .addMetric(ProtonMetrics.DOCUMENTS_READY_COUNT, 11430) - .addMetric(ProtonMetrics.DOCUMENTS_TOTAL_COUNT, 11430) - .addMetric(ProtonMetrics.DOCUMENT_DISK_USAGE, 44021) - .addMetric(ProtonMetrics.RESOURCE_DISK_USAGE_AVERAGE, 0.0168421) - .addMetric(ProtonMetrics.RESOURCE_MEMORY_USAGE_AVERAGE, 0.103482), - (new ProtonMetrics("content/music/")) - .addMetric(ProtonMetrics.DOCUMENTS_ACTIVE_COUNT, 32210) - .addMetric(ProtonMetrics.DOCUMENTS_READY_COUNT, 32000) - .addMetric(ProtonMetrics.DOCUMENTS_TOTAL_COUNT, 32210) - .addMetric(ProtonMetrics.DOCUMENT_DISK_USAGE, 90113) - .addMetric(ProtonMetrics.RESOURCE_DISK_USAGE_AVERAGE, 0.23912) - .addMetric(ProtonMetrics.RESOURCE_MEMORY_USAGE_AVERAGE, 0.00912) + (new SearchNodeMetrics("content/doc/")) + .addMetric(SearchNodeMetrics.DOCUMENTS_ACTIVE_COUNT, 11430) + .addMetric(SearchNodeMetrics.DOCUMENTS_READY_COUNT, 11430) + .addMetric(SearchNodeMetrics.DOCUMENTS_TOTAL_COUNT, 11430) + .addMetric(SearchNodeMetrics.DOCUMENT_DISK_USAGE, 44021) + .addMetric(SearchNodeMetrics.RESOURCE_DISK_USAGE_AVERAGE, 0.0168421) + .addMetric(SearchNodeMetrics.RESOURCE_MEMORY_USAGE_AVERAGE, 0.103482), + (new SearchNodeMetrics("content/music/")) + .addMetric(SearchNodeMetrics.DOCUMENTS_ACTIVE_COUNT, 32210) + .addMetric(SearchNodeMetrics.DOCUMENTS_READY_COUNT, 32000) + .addMetric(SearchNodeMetrics.DOCUMENTS_TOTAL_COUNT, 32210) + .addMetric(SearchNodeMetrics.DOCUMENT_DISK_USAGE, 90113) + .addMetric(SearchNodeMetrics.RESOURCE_DISK_USAGE_AVERAGE, 0.23912) + .addMetric(SearchNodeMetrics.RESOURCE_MEMORY_USAGE_AVERAGE, 0.00912) )); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java index 8bda8ba0d59..82783485158 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java @@ -87,13 +87,12 @@ public class ConfigServerApiHandlerTest extends ControllerContainerTest { @Test void test_allowed_apis() { - // GET /configserver/v1/prod/us-north-1 tester.assertResponse(() -> operatorRequest("http://localhost:8080/configserver/v1/prod/us-north-1/"), - "{\"error-code\":\"FORBIDDEN\",\"message\":\"Cannot access path '/' through /configserver/v1, following APIs are permitted: /flags/v1/, /nodes/v2/, /orchestrator/v1/\"}", + "{\"error-code\":\"FORBIDDEN\",\"message\":\"Cannot access path '/' through /configserver/v1, following APIs are permitted: /flags/v1/, /nodes/v2/, /orchestrator/v1/, /state/v1/\"}", 403); tester.assertResponse(() -> operatorRequest("http://localhost:8080/configserver/v1/prod/us-north-1/application/v2/tenant/vespa"), - "{\"error-code\":\"FORBIDDEN\",\"message\":\"Cannot access path '/application/v2/tenant/vespa' through /configserver/v1, following APIs are permitted: /flags/v1/, /nodes/v2/, /orchestrator/v1/\"}", + "{\"error-code\":\"FORBIDDEN\",\"message\":\"Cannot access path '/application/v2/tenant/vespa' through /configserver/v1, following APIs are permitted: /flags/v1/, /nodes/v2/, /orchestrator/v1/, /state/v1/\"}", 403); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiTest.java index ac7287b7e27..966c7f02cee 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiTest.java @@ -162,7 +162,7 @@ public class ControllerApiTest extends ControllerContainerTest { new NodeResources(12, 48, 1200, 0, NodeResources.DiskSpeed.any, NodeResources.StorageType.any, NodeResources.Architecture.arm64), new NodeResources(24, 96, 2400, 0, NodeResources.DiskSpeed.any, NodeResources.StorageType.any, NodeResources.Architecture.x86_64)); - var snapshots = resources.stream().map(x -> new ResourceSnapshot(applicationId, x, timestamp, zoneId, Version.emptyVersion)).toList(); + var snapshots = resources.stream().map(x -> new ResourceSnapshot(applicationId, x, timestamp, zoneId, 0)).toList(); tester.controller().serviceRegistry().resourceDatabase().writeResourceSnapshots(snapshots); tester.assertResponse( diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/responses/maintenance.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/responses/maintenance.json index 113ad1af6d1..34a3520dd1d 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/responses/maintenance.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/responses/maintenance.json @@ -28,6 +28,9 @@ "name": "ChangeRequestMaintainer" }, { + "name": "CloudDatabaseMaintainer" + }, + { "name": "CloudTrialExpirer" }, { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/responses/metering.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/responses/metering.json index cf7738efe7f..475bf1d449a 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/responses/metering.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/controller/responses/metering.json @@ -6,7 +6,10 @@ "cpu": 12.0, "memory": 48.0, "disk": 1200.0, - "architecture": "arm64" + "architecture": "arm64", + "version": 0, + "gpuMemoryGb": 0.0, + "gpuCount": 0 }, { "applicationId": "tenant.app.instance", @@ -15,6 +18,9 @@ "cpu": 24.0, "memory": 96.0, "disk": 2400.0, - "architecture": "x86_64" + "architecture": "x86_64", + "version": 0, + "gpuMemoryGb": 0.0, + "gpuCount": 0 } ] diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiTest.java index 075e001655f..b3c992cdac7 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiTest.java @@ -8,6 +8,7 @@ import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.InMemoryFlagSource; import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.controller.ControllerTester; +import com.yahoo.vespa.hosted.controller.api.integration.billing.MockBillingController; import com.yahoo.vespa.hosted.controller.api.integration.billing.PlanId; import com.yahoo.jdisc.http.filter.security.misc.User; import com.yahoo.vespa.hosted.controller.api.integration.user.UserId; @@ -19,6 +20,7 @@ import com.yahoo.vespa.hosted.controller.tenant.Tenant; import org.junit.jupiter.api.Test; import java.io.File; +import java.util.List; import java.util.Set; import static com.yahoo.application.container.handler.Request.Method.DELETE; @@ -262,6 +264,7 @@ public class UserApiTest extends ControllerContainerCloudTest { .withBooleanFlag(PermanentFlags.ENABLE_PUBLIC_SIGNUP_FLOW.id(), true); Set<Role> operator = Set.of(Role.hostedOperator(), Role.hostedSupporter(), Role.hostedAccountant()); User user = new User("dev@domail", "Joe Developer", "dev", null); + tester.controller().serviceRegistry().billingController().updateCache(List.of()); Role developer = Role.developer(TenantName.from("scoober")); tester.userManagement().createRole(developer); @@ -292,6 +295,7 @@ public class UserApiTest extends ControllerContainerCloudTest { User user = new User("dev@domail", "Joe Developer", "dev", null); controller.createTenant("tenant1", Tenant.Type.cloud); + ((MockBillingController) controller.serviceRegistry().billingController()).setTenants(controller.controller().tenants().asList().stream().map(Tenant::name).toList()); tester.assertResponse( request("/user/v1/user").user(user), |