diff options
author | Øyvind Grønnesby <oyving@yahooinc.com> | 2023-10-16 15:33:40 +0200 |
---|---|---|
committer | Øyvind Grønnesby <oyving@yahooinc.com> | 2023-10-16 15:33:40 +0200 |
commit | c3dccf9252181dca05329585c9ec97dc89393c5e (patch) | |
tree | 56475a52398a5087796f72ee7da091cc82f73551 | |
parent | 1954438841002899640641363169f5c56d5d2724 (diff) | |
parent | 2c243871f2ddf031abe4ba1ebd2e84b78be8658c (diff) |
Merge remote-tracking branch 'origin/master' into ogronnesby/additional-items-v2
20 files changed, 188 insertions, 233 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/UserConfiguredFiles.java b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/UserConfiguredFiles.java index e4eaa02acd5..47ae2f40414 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/UserConfiguredFiles.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/UserConfiguredFiles.java @@ -69,7 +69,6 @@ public class UserConfiguredFiles implements Serializable { if (configDefinition == null) { String message = "Unable to find config definition " + key + ". Will not register files for file distribution for this config"; switch (unknownConfigDefinition) { - case "log" -> logger.logApplicationPackage(Level.INFO, message); case "warning" -> logger.logApplicationPackage(Level.WARNING, message); case "fail" -> throw new IllegalArgumentException("Unable to find config definition for " + key); } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/MockPricingController.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/MockPricingController.java index 0aa07e93010..6fe7017e3b7 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/MockPricingController.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/MockPricingController.java @@ -34,8 +34,7 @@ public class MockPricingController implements PricingController { BigDecimal appTotalAmount = listPrice.add(supportLevelCost).add(enclaveDiscount).add(volumeDiscount); List<PriceInformation> appPrices = applicationResources.stream() - .map(appResources -> new PriceInformation(appResources.applicationName(), - listPriceWithSupport, + .map(appResources -> new PriceInformation(listPriceWithSupport, volumeDiscount, ZERO, enclaveDiscount, @@ -45,7 +44,7 @@ public class MockPricingController implements PricingController { PriceInformation sum = PriceInformation.sum(appPrices); var committedAmountDiscount = new BigDecimal("-1.23"); var totalAmount = sum.totalAmount().add(committedAmountDiscount); - var totalPrice = new PriceInformation("total", ZERO, ZERO, committedAmountDiscount, ZERO, totalAmount); + var totalPrice = new PriceInformation(ZERO, ZERO, committedAmountDiscount, ZERO, totalAmount); return new Prices(appPrices, totalPrice); } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/pricing/ApplicationResources.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/pricing/ApplicationResources.java index fa742c27486..106d9ab6bbe 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/pricing/ApplicationResources.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/pricing/ApplicationResources.java @@ -5,7 +5,6 @@ import java.math.BigDecimal; import static java.math.BigDecimal.ZERO; /** - * @param applicationName name of the application * @param vcpu vcpus summed over all clusters, instances, zones * @param memoryGb memory in Gb summed over all clusters, instances, zones * @param diskGb disk in Gb summed over all clusters, instances, zones @@ -15,18 +14,20 @@ import static java.math.BigDecimal.ZERO; * @param enclaveDiskGb disk in Gb summed over all clusters, instances, zones * @param enclaveGpuMemoryGb GPU memory in Gb summed over all clusters, instances, zones */ -public record ApplicationResources(String applicationName, BigDecimal vcpu, BigDecimal memoryGb, BigDecimal diskGb, +public record ApplicationResources(BigDecimal vcpu, BigDecimal memoryGb, BigDecimal diskGb, BigDecimal gpuMemoryGb, BigDecimal enclaveVcpu, BigDecimal enclaveMemoryGb, BigDecimal enclaveDiskGb, BigDecimal enclaveGpuMemoryGb) { - public static ApplicationResources create(String applicationName, BigDecimal vcpu, BigDecimal memoryGb, + public static ApplicationResources create(BigDecimal vcpu, BigDecimal memoryGb, BigDecimal diskGb, BigDecimal gpuMemoryGb) { - return new ApplicationResources(applicationName, vcpu, memoryGb, diskGb, gpuMemoryGb, ZERO, ZERO, ZERO, ZERO); + return new ApplicationResources(vcpu, memoryGb, diskGb, gpuMemoryGb, ZERO, ZERO, ZERO, ZERO); } - public static ApplicationResources createEnclave(String applicationName, BigDecimal vcpu, BigDecimal memoryGb, + public static ApplicationResources createEnclave(BigDecimal vcpu, BigDecimal memoryGb, BigDecimal diskGb, BigDecimal gpuMemoryGb) { - return new ApplicationResources(applicationName, ZERO, ZERO, ZERO, ZERO, vcpu, memoryGb, diskGb, gpuMemoryGb); + return new ApplicationResources(ZERO, ZERO, ZERO, ZERO, vcpu, memoryGb, diskGb, gpuMemoryGb); } + public boolean enclave() { return enclaveVcpu().compareTo(ZERO) > 0; } + } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/pricing/PriceInformation.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/pricing/PriceInformation.java index 2c37b122b04..50463553f8e 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/pricing/PriceInformation.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/pricing/PriceInformation.java @@ -6,10 +6,10 @@ import java.util.List; import static java.math.BigDecimal.ZERO; -public record PriceInformation(String applicationName, BigDecimal listPriceWithSupport, BigDecimal volumeDiscount, +public record PriceInformation(BigDecimal listPriceWithSupport, BigDecimal volumeDiscount, BigDecimal committedAmountDiscount, BigDecimal enclaveDiscount, BigDecimal totalAmount) { - public static PriceInformation empty() { return new PriceInformation("default", ZERO, ZERO, ZERO, ZERO, ZERO); } + public static PriceInformation empty() { return new PriceInformation(ZERO, ZERO, ZERO, ZERO, ZERO); } public static PriceInformation sum(List<PriceInformation> priceInformationList) { var result = PriceInformation.empty(); @@ -19,8 +19,7 @@ public record PriceInformation(String applicationName, BigDecimal listPriceWithS } public PriceInformation add(PriceInformation priceInformation) { - return new PriceInformation("accumulated", - this.listPriceWithSupport().add(priceInformation.listPriceWithSupport()), + return new PriceInformation(this.listPriceWithSupport().add(priceInformation.listPriceWithSupport()), this.volumeDiscount().add(priceInformation.volumeDiscount()), this.committedAmountDiscount().add(priceInformation.committedAmountDiscount()), this.enclaveDiscount().add(priceInformation.enclaveDiscount()), diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/pricing/Prices.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/pricing/Prices.java index 2ebd6ba5d38..650a07c51e0 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/pricing/Prices.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/pricing/Prices.java @@ -5,10 +5,4 @@ import java.util.List; public record Prices(List<PriceInformation> priceInformationApplications, PriceInformation totalPriceInformation) { - public PriceInformation get(String applicationName) { - return priceInformationApplications.stream() - .filter(priceInformation -> priceInformation.applicationName().equals(applicationName)) - .findFirst().orElseThrow(() -> new IllegalArgumentException("Unknown application name " + applicationName)); - } - } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java index 51e20d0017c..f9798fb2559 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java @@ -14,9 +14,9 @@ import com.yahoo.config.provision.zone.AuthMethod; import com.yahoo.config.provision.zone.RoutingMethod; import com.yahoo.config.provision.zone.ZoneApi; import com.yahoo.config.provision.zone.ZoneId; -import com.yahoo.vespa.flags.BooleanFlag; import com.yahoo.vespa.flags.FetchVector; import com.yahoo.vespa.flags.Flags; +import com.yahoo.vespa.flags.StringFlag; import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; import com.yahoo.vespa.hosted.controller.api.integration.certificates.EndpointCertificate; import com.yahoo.vespa.hosted.controller.api.integration.dns.Record; @@ -82,8 +82,7 @@ public class RoutingController { private final Controller controller; private final RoutingPolicies routingPolicies; private final RotationRepository rotationRepository; - private final BooleanFlag generatedEndpoints; - private final BooleanFlag legacyEndpoints; + private final StringFlag endpointConfig; public RoutingController(Controller controller, RotationsConfig rotationsConfig) { this.controller = Objects.requireNonNull(controller, "controller must be non-null"); @@ -91,8 +90,7 @@ public class RoutingController { this.rotationRepository = new RotationRepository(Objects.requireNonNull(rotationsConfig, "rotationsConfig must be non-null"), controller.applications(), controller.curator()); - this.generatedEndpoints = Flags.RANDOMIZED_ENDPOINT_NAMES.bindTo(controller.flagSource()); - this.legacyEndpoints = Flags.LEGACY_ENDPOINTS.bindTo(controller.flagSource()); + this.endpointConfig = Flags.ENDPOINT_CONFIG.bindTo(controller.flagSource()); } /** Create a routing context for given deployment */ @@ -124,15 +122,17 @@ public class RoutingController { /** Returns the endpoint config to use for given instance */ public EndpointConfig endpointConfig(ApplicationId instance) { - // TODO(mpolden): Switch to reading endpoint-config flag - if (legacyEndpointsEnabled(instance)) { - if (generatedEndpointsEnabled(instance)) { - return EndpointConfig.combined; - } else { - return EndpointConfig.legacy; - } - } - return EndpointConfig.generated; + String flagValue = endpointConfig.with(FetchVector.Dimension.TENANT_ID, instance.tenant().value()) + .with(FetchVector.Dimension.APPLICATION_ID, TenantAndApplicationId.from(instance).serialized()) + .with(FetchVector.Dimension.INSTANCE_ID, instance.serializedForm()) + .value(); + return switch (flagValue) { + case "legacy" -> EndpointConfig.legacy; + case "combined" -> EndpointConfig.combined; + case "generated" -> EndpointConfig.generated; + default -> throw new IllegalArgumentException("Invalid endpoint-config flag value: '" + flagValue + "', must be " + + "'legacy', 'combined' or 'generated'"); + }; } /** Prepares and returns the endpoints relevant for given deployment */ @@ -600,20 +600,6 @@ public class RoutingController { return Collections.unmodifiableList(routingMethods); } - private boolean generatedEndpointsEnabled(ApplicationId instance) { - return generatedEndpoints.with(FetchVector.Dimension.INSTANCE_ID, instance.serializedForm()) - .with(FetchVector.Dimension.TENANT_ID, instance.tenant().value()) - .with(FetchVector.Dimension.APPLICATION_ID, TenantAndApplicationId.from(instance).serialized()) - .value(); - } - - private boolean legacyEndpointsEnabled(ApplicationId instance) { - return legacyEndpoints.with(FetchVector.Dimension.INSTANCE_ID, instance.serializedForm()) - .with(FetchVector.Dimension.TENANT_ID, instance.tenant().value()) - .with(FetchVector.Dimension.APPLICATION_ID, TenantAndApplicationId.from(instance).serialized()) - .value(); - } - private static void requireGeneratedEndpoints(GeneratedEndpointList generatedEndpoints, boolean declared) { if (generatedEndpoints.asList().stream().anyMatch(ge -> ge.declared() != declared)) { throw new IllegalStateException("All generated endpoints require declared=" + declared + diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandler.java index 48ddd59e3f2..6ef247c5b41 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandler.java @@ -152,7 +152,6 @@ public class PricingApiHandler extends ThreadedHttpRequestHandler { private ApplicationResources applicationResources(String appResourcesString) { List<String> elements = Arrays.stream(appResourcesString.split(",")).toList(); - var applicationName = "default"; var vcpu = ZERO; var memoryGb = ZERO; var diskGb = ZERO; @@ -165,8 +164,6 @@ public class PricingApiHandler extends ThreadedHttpRequestHandler { for (var element : keysAndValues(elements)) { var value = element.getSecond(); switch (element.getFirst().toLowerCase()) { - case "name" -> applicationName = value; - case "vcpu" -> vcpu = new BigDecimal(value); case "memorygb" -> memoryGb = new BigDecimal(value); case "diskgb" -> diskGb = new BigDecimal(value); @@ -181,7 +178,7 @@ public class PricingApiHandler extends ThreadedHttpRequestHandler { } } - return new ApplicationResources(applicationName, vcpu, memoryGb, diskGb, gpuMemoryGb, + return new ApplicationResources(vcpu, memoryGb, diskGb, gpuMemoryGb, enclaveVcpu, enclaveMemoryGb, enclaveDiskGb, enclaveGpuMemoryGb); } @@ -218,12 +215,10 @@ public class PricingApiHandler extends ThreadedHttpRequestHandler { private static void applicationPrices(Cursor applicationPricesArray, List<PriceInformation> applicationPrices, PriceParameters priceParameters) { applicationPrices.forEach(priceInformation -> { var element = applicationPricesArray.addObject(); - element.setString("name", priceInformation.applicationName()); var array = element.setArray("priceInfo"); addItem(array, supportLevelDescription(priceParameters), priceInformation.listPriceWithSupport()); addItem(array, "Enclave", priceInformation.enclaveDiscount()); addItem(array, "Volume discount", priceInformation.volumeDiscount()); - }); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificatesTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificatesTest.java index 7faaee95abb..378b92d37ce 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificatesTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificatesTest.java @@ -303,8 +303,7 @@ public class EndpointCertificatesTest { @Test public void assign_certificate_from_pool() { - tester.flagSource().withBooleanFlag(Flags.RANDOMIZED_ENDPOINT_NAMES.id(), true); - tester.flagSource().withBooleanFlag(Flags.LEGACY_ENDPOINTS.id(), false); + setEndpointConfig(tester, EndpointConfig.generated); try { addCertificateToPool("bad0f00d", UnassignedCertificate.State.requested, tester); endpointCertificates.get(new DeploymentId(instance, prodZone), DeploymentSpec.empty, lock); @@ -340,7 +339,7 @@ public class EndpointCertificatesTest { @Test public void certificate_migration() { - // An application is initially deployed with legacy config + // An application is initially deployed with legacy config (the default) ZoneId zone1 = ZoneId.from(Environment.prod, RegionName.from("aws-us-east-1c")); ApplicationPackage applicationPackage = new ApplicationPackageBuilder().region(zone1.region()) .build(); @@ -408,8 +407,7 @@ public class EndpointCertificatesTest { devCert0.requestedDnsSans()); // Application switches to combined config - tester.flagSource().withBooleanFlag(Flags.RANDOMIZED_ENDPOINT_NAMES.id(), true); - tester.flagSource().withBooleanFlag(Flags.LEGACY_ENDPOINTS.id(), true); + setEndpointConfig(tester, EndpointConfig.combined); tester.clock().advance(Duration.ofHours(1)); assertEquals(certificate.withLastRequested(tester.clock().instant().getEpochSecond()), endpointCertificates.get(deployment0, applicationPackage.deploymentSpec(), lock), @@ -420,7 +418,7 @@ public class EndpointCertificatesTest { "Certificate is not assigned at application level"); // Application switches to generated config - tester.flagSource().withBooleanFlag(Flags.LEGACY_ENDPOINTS.id(), false); + setEndpointConfig(tester, EndpointConfig.generated); tester.clock().advance(Duration.ofHours(1)); assertEquals(certificate.withLastRequested(tester.clock().instant().getEpochSecond()), endpointCertificates.get(deployment0, applicationPackage.deploymentSpec(), lock), @@ -451,8 +449,7 @@ public class EndpointCertificatesTest { assertEquals(poolCertId1, prodCertificate.generatedId().get()); // Application switches back to legacy config - tester.flagSource().withBooleanFlag(Flags.RANDOMIZED_ENDPOINT_NAMES.id(), false); - tester.flagSource().withBooleanFlag(Flags.LEGACY_ENDPOINTS.id(), true); + setEndpointConfig(tester, EndpointConfig.legacy); EndpointCertificate reissuedCertificate = endpointCertificates.get(deployment0, applicationPackage.deploymentSpec(), lock); assertEquals(certificate.requestedDnsSans(), reissuedCertificate.requestedDnsSans()); assertTrue(tester.curator().readAssignedCertificate(deployment0.applicationId()).isPresent(), "Certificate is assigned at instance level again"); @@ -460,6 +457,10 @@ public class EndpointCertificatesTest { "Certificate is still assigned at application level"); // Not removed because the assumption is that the application will eventually migrate back } + private void setEndpointConfig(ControllerTester tester, EndpointConfig config) { + tester.flagSource().withStringFlag(Flags.ENDPOINT_CONFIG.id(), config.name()); + } + private void addCertificateToPool(String id, UnassignedCertificate.State state, ControllerTester tester) { EndpointCertificate cert = new EndpointCertificate(testKeyName, testCertName, diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/EndpointCertificateMaintainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/EndpointCertificateMaintainerTest.java index f551a99829e..fe9e9b28655 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/EndpointCertificateMaintainerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/EndpointCertificateMaintainerTest.java @@ -26,6 +26,7 @@ import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder; import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext; import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester; import com.yahoo.vespa.hosted.controller.integration.SecretStoreMock; +import com.yahoo.vespa.hosted.controller.routing.EndpointConfig; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; @@ -262,9 +263,8 @@ public class EndpointCertificateMaintainerTest { } private void prepareCertificatePool(int numCertificates) { - ((InMemoryFlagSource)tester.controller().flagSource()).withIntFlag(PermanentFlags.CERT_POOL_SIZE.id(), numCertificates); - ((InMemoryFlagSource)tester.controller().flagSource()).withBooleanFlag(Flags.RANDOMIZED_ENDPOINT_NAMES.id(), true); - ((InMemoryFlagSource)tester.controller().flagSource()).withBooleanFlag(Flags.LEGACY_ENDPOINTS.id(), false); + ((InMemoryFlagSource) tester.controller().flagSource()).withIntFlag(PermanentFlags.CERT_POOL_SIZE.id(), numCertificates); + ((InMemoryFlagSource) tester.controller().flagSource()).withStringFlag(Flags.ENDPOINT_CONFIG.id(), EndpointConfig.generated.name()); // Provision certificates for (int i = 0; i < numCertificates; i++) { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandlerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandlerTest.java index 6262697f0c3..63636b3ff20 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandlerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/pricing/PricingApiHandlerTest.java @@ -19,149 +19,134 @@ import static org.junit.jupiter.api.Assertions.assertEquals; */ public class PricingApiHandlerTest extends ControllerContainerCloudTest { - private static final String responseFiles = "src/test/java/com/yahoo/vespa/hosted/controller/restapi/pricing/responses/"; - @Test void testPricingInfoBasic() { - ContainerTester tester = new ContainerTester(container, responseFiles); - assertEquals(SystemName.Public, tester.controller().system()); - var request = request("/pricing/v1/pricing?" + urlEncodedPriceInformation1App(BASIC)); - tester.assertJsonResponse(request, """ - { - "applications": [ - { - "name": "app1", - "priceInfo": [ - {"description": "Basic support unit price", "amount": "2240.00"}, - {"description": "Volume discount", "amount": "-5.64"} - ] - } - ], - "priceInfo": [ - {"description": "Committed spend", "amount": "-1.23"} - ], - "totalAmount": "2233.13" - } - """, - 200); + tester().assertJsonResponse(request, """ + { + "applications": [ + { + "priceInfo": [ + {"description": "Basic support unit price", "amount": "2240.00"}, + {"description": "Volume discount", "amount": "-5.64"} + ] + } + ], + "priceInfo": [ + {"description": "Committed spend", "amount": "-1.23"} + ], + "totalAmount": "2233.13" + } + """, + 200); } @Test void testPricingInfoBasicEnclave() { - ContainerTester tester = new ContainerTester(container, responseFiles); - assertEquals(SystemName.Public, tester.controller().system()); - var request = request("/pricing/v1/pricing?" + urlEncodedPriceInformation1AppEnclave(BASIC)); - tester.assertJsonResponse(request, """ - { - "applications": [ - { - "name": "app1", - "priceInfo": [ - {"description": "Basic support unit price", "amount": "2240.00"}, - {"description": "Enclave", "amount": "-15.12"}, - {"description": "Volume discount", "amount": "-5.64"} - ] - } - ], - "priceInfo": [ - {"description": "Committed spend", "amount": "-1.23"} - ], - "totalAmount": "2218.00" - } - """, - 200); + tester().assertJsonResponse(request, """ + { + "applications": [ + { + "priceInfo": [ + {"description": "Basic support unit price", "amount": "2240.00"}, + {"description": "Enclave", "amount": "-15.12"}, + {"description": "Volume discount", "amount": "-5.64"} + ] + } + ], + "priceInfo": [ + {"description": "Committed spend", "amount": "-1.23"} + ], + "totalAmount": "2218.00" + } + """, + 200); } @Test void testPricingInfoCommercialEnclave() { - ContainerTester tester = new ContainerTester(container, responseFiles); - assertEquals(SystemName.Public, tester.controller().system()); - var request = request("/pricing/v1/pricing?" + urlEncodedPriceInformation1AppEnclave(COMMERCIAL)); - tester.assertJsonResponse(request, """ - { - "applications": [ - { - "name": "app1", - "priceInfo": [ - {"description": "Commercial support unit price", "amount": "3200.00"}, - {"description": "Enclave", "amount": "-15.12"}, - {"description": "Volume discount", "amount": "-5.64"} - ] - } - ], - "priceInfo": [ - {"description": "Committed spend", "amount": "-1.23"} - ], - "totalAmount": "3178.00" - } - """, - 200); + tester().assertJsonResponse(request, """ + { + "applications": [ + { + "priceInfo": [ + {"description": "Commercial support unit price", "amount": "3200.00"}, + {"description": "Enclave", "amount": "-15.12"}, + {"description": "Volume discount", "amount": "-5.64"} + ] + } + ], + "priceInfo": [ + {"description": "Committed spend", "amount": "-1.23"} + ], + "totalAmount": "3178.00" + } + """, + 200); } @Test void testPricingInfoCommercialEnclave2Apps() { - ContainerTester tester = new ContainerTester(container, responseFiles); - assertEquals(SystemName.Public, tester.controller().system()); - var request = request("/pricing/v1/pricing?" + urlEncodedPriceInformation2AppsEnclave(COMMERCIAL)); - tester.assertJsonResponse(request, """ - { - "applications": [ - { - "name": "app1", - "priceInfo": [ - {"description": "Commercial support unit price", "amount": "2000.00"}, - {"description": "Enclave", "amount": "-15.12"}, - {"description": "Volume discount", "amount": "-5.64"} - ] - }, - { - "name": "app2", - "priceInfo": [ - {"description": "Commercial support unit price", "amount": "2000.00"}, - {"description": "Enclave", "amount": "-15.12"}, - {"description": "Volume discount", "amount": "-5.64"} - ] - } - ], - "priceInfo": [ - {"description": "Committed spend", "amount": "-1.23"} - ], - "totalAmount": "3957.24" - } - """, - 200); + tester().assertJsonResponse(request, """ + { + "applications": [ + { + "priceInfo": [ + {"description": "Commercial support unit price", "amount": "2000.00"}, + {"description": "Enclave", "amount": "-15.12"}, + {"description": "Volume discount", "amount": "-5.64"} + ] + }, + { + "priceInfo": [ + {"description": "Commercial support unit price", "amount": "2000.00"}, + {"description": "Enclave", "amount": "-15.12"}, + {"description": "Volume discount", "amount": "-5.64"} + ] + } + ], + "priceInfo": [ + {"description": "Committed spend", "amount": "-1.23"} + ], + "totalAmount": "3957.24" + } + """, + 200); } @Test void testInvalidRequests() { - ContainerTester tester = new ContainerTester(container, responseFiles); - assertEquals(SystemName.Public, tester.controller().system()); - + ContainerTester tester = tester(); tester.assertJsonResponse(request("/pricing/v1/pricing"), - "{\"error-code\":\"BAD_REQUEST\",\"message\":\"No price information found in query\"}", - 400); + "{\"error-code\":\"BAD_REQUEST\",\"message\":\"No price information found in query\"}", + 400); tester.assertJsonResponse(request("/pricing/v1/pricing?"), - "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Error in query parameter, expected '=' between key and value: ''\"}", - 400); + "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Error in query parameter, expected '=' between key and value: ''\"}", + 400); tester.assertJsonResponse(request("/pricing/v1/pricing?supportLevel=basic&committedSpend=0"), - "{\"error-code\":\"BAD_REQUEST\",\"message\":\"No application resources found in query\"}", - 400); + "{\"error-code\":\"BAD_REQUEST\",\"message\":\"No application resources found in query\"}", + 400); tester.assertJsonResponse(request("/pricing/v1/pricing?supportLevel=basic&committedSpend=0&resources"), - "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Error in query parameter, expected '=' between key and value: 'resources'\"}", - 400); + "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Error in query parameter, expected '=' between key and value: 'resources'\"}", + 400); tester.assertJsonResponse(request("/pricing/v1/pricing?supportLevel=basic&committedSpend=0&resources="), - "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Error in query parameter, expected '=' between key and value: 'resources='\"}", - 400); + "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Error in query parameter, expected '=' between key and value: 'resources='\"}", + 400); tester.assertJsonResponse(request("/pricing/v1/pricing?supportLevel=basic&committedSpend=0&key=value"), - "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Unknown query parameter 'key'\"}", - 400); + "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Unknown query parameter 'key'\"}", + 400); tester.assertJsonResponse(request("/pricing/v1/pricing?supportLevel=basic&committedSpend=0&application=key%3Dvalue"), - "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Unknown key 'key'\"}", - 400); + "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Unknown key 'key'\"}", + 400); + } + + private ContainerTester tester() { + ContainerTester tester = new ContainerTester(container, null); + assertEquals(SystemName.Public, tester.controller().system()); + return tester; } /** @@ -170,7 +155,7 @@ public class PricingApiHandlerTest extends ControllerContainerCloudTest { * price will be 20000 + 2000 + 200 */ String urlEncodedPriceInformation1App(PricingInfo.SupportLevel supportLevel) { - return "application=" + URLEncoder.encode("name=app1,vcpu=2,memoryGb=2,diskGb=20,gpuMemoryGb=0", UTF_8) + + return "application=" + URLEncoder.encode("vcpu=2,memoryGb=2,diskGb=20,gpuMemoryGb=0", UTF_8) + "&supportLevel=" + supportLevel.name().toLowerCase() + "&committedSpend=100"; } @@ -180,7 +165,7 @@ public class PricingApiHandlerTest extends ControllerContainerCloudTest { * price will be 20000 + 2000 + 200 */ String urlEncodedPriceInformation1AppEnclave(PricingInfo.SupportLevel supportLevel) { - return "application=" + URLEncoder.encode("name=app1,enclaveVcpu=2,enclaveMemoryGb=2,enclaveDiskGb=20,enclaveGpuMemoryGb=0", UTF_8) + + return "application=" + URLEncoder.encode("enclaveVcpu=2,enclaveMemoryGb=2,enclaveDiskGb=20,enclaveGpuMemoryGb=0", UTF_8) + "&supportLevel=" + supportLevel.name().toLowerCase() + "&committedSpend=100"; } @@ -189,8 +174,8 @@ public class PricingApiHandlerTest extends ControllerContainerCloudTest { * 1 node, with 1 vcpu, 1 Gb memory, 10 Gb disk and no GPU */ String urlEncodedPriceInformation2AppsEnclave(PricingInfo.SupportLevel supportLevel) { - return "application=" + URLEncoder.encode("name=app1,enclaveVcpu=1,enclaveMemoryGb=1,enclaveDiskGb=10,enclaveGpuMemoryGb=0", UTF_8) + - "&application=" + URLEncoder.encode("name=app2,enclaveVcpu=1,enclaveMemoryGb=1,enclaveDiskGb=10,enclaveGpuMemoryGb=0", UTF_8) + + return "application=" + URLEncoder.encode("enclaveVcpu=1,enclaveMemoryGb=1,enclaveDiskGb=10,enclaveGpuMemoryGb=0", UTF_8) + + "&application=" + URLEncoder.encode("enclaveVcpu=1,enclaveMemoryGb=1,enclaveDiskGb=10,enclaveGpuMemoryGb=0", UTF_8) + "&supportLevel=" + supportLevel.name().toLowerCase() + "&committedSpend=0"; } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java index a10bfd46b0c..a671f567895 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java @@ -46,7 +46,6 @@ import com.yahoo.vespa.hosted.controller.dns.NameServiceQueue; import com.yahoo.vespa.hosted.controller.dns.RemoveRecords; import com.yahoo.vespa.hosted.controller.integration.ZoneApiMock; import com.yahoo.vespa.hosted.rotation.config.RotationsConfig; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; @@ -113,6 +112,11 @@ public class RoutingPoliciesTest { private static final ZoneId zone5 = zoneApi5.getId(); private static final ZoneId zone6 = zoneApi6.getId(); + private static final ZoneId testZonePublic = ZoneId.from("test", "aws-us-east-2c"); + private static final ZoneId stagingZonePublic = ZoneId.from("staging", "aws-us-east-3c"); + private static final ZoneId testZoneMain = ZoneId.from("test", "us-east-1"); + private static final ZoneId stagingZoneMain = ZoneId.from("staging", "us-east-3"); + private static final ApplicationPackage applicationPackage = applicationPackageBuilder().region(zone1.region()) .region(zone2.region()) .build(); @@ -400,20 +404,24 @@ public class RoutingPoliciesTest { } @Test - @Disabled // TODO(mpolden): Enable this test when we start creating generated endpoints for shared routing - void zone_routing_policies_with_shared_routing_and_generated_endpoint() { + void zone_routing_policies_with_shared_routing_and_generated_endpoint_config_and_token() { var tester = new RoutingPoliciesTester(new DeploymentTester(), false); var context = tester.newDeploymentContext("tenant1", "app1", "default"); - tester.provisionLoadBalancers(1, context.instanceId(), true, zone1, zone2); - tester.controllerTester().flagSource().withBooleanFlag(Flags.RANDOMIZED_ENDPOINT_NAMES.id(), true); + tester.setEndpointConfig(EndpointConfig.generated); addCertificateToPool("cafed00d", UnassignedCertificate.State.ready, tester); ApplicationPackage applicationPackage = applicationPackageBuilder().region(zone1.region()) .region(zone2.region()) .container("c0", AuthMethod.mtls, AuthMethod.token) .build(); + tester.provisionLoadBalancers(1, context.instanceId(), true, + testZoneMain, stagingZoneMain, zone1, zone2); context.submit(applicationPackage).deferLoadBalancerProvisioningIn(Environment.prod).deploy(); - assertEquals(List.of("c0a25b7c.cafed00d.z.vespa.oath.cloud", - "dc5e383c.cafed00d.z.vespa.oath.cloud"), + // This only creates wildcard endpoint names in DNS because legacy names in shared routing-mode use a static + // wildcard DNS record pointing to the routing layer + assertEquals(List.of("a9c8c045.cafed00d.z.vespa.oath.cloud", + "dc5e383c.cafed00d.z.vespa.oath.cloud", + "ebd395b6.cafed00d.z.vespa.oath.cloud", + "ee82b867.cafed00d.z.vespa.oath.cloud"), tester.recordNames()); } @@ -1215,9 +1223,7 @@ public class RoutingPoliciesTest { .container("c0", AuthMethod.mtls) .endpoint("foo", "c0") .build(); - tester.provisionLoadBalancers(1, context.instanceId(), ZoneId.from("test", "aws-us-east-2c")); - tester.provisionLoadBalancers(1, context.instanceId(), ZoneId.from("staging", "aws-us-east-3c")); - tester.provisionLoadBalancers(1, context.instanceId(), zone1); + tester.provisionLoadBalancers(1, context.instanceId(), testZonePublic, stagingZonePublic, zone1); context.submit(applicationPackage).deferLoadBalancerProvisioningIn(Environment.test, Environment.staging, Environment.prod).deploy(); assertEquals(List.of("a9c8c045.cafed00d.g.vespa-app.cloud", "ebd395b6.cafed00d.z.vespa-app.cloud", @@ -1229,8 +1235,7 @@ public class RoutingPoliciesTest { .container("c0", AuthMethod.mtls, AuthMethod.token) .endpoint("foo", "c0") .build(); - tester.provisionLoadBalancers(1, context.instanceId(), ZoneId.from("test", "aws-us-east-2c")); - tester.provisionLoadBalancers(1, context.instanceId(), ZoneId.from("staging", "aws-us-east-3c")); + tester.provisionLoadBalancers(1, context.instanceId(), testZonePublic, stagingZonePublic); context.submit(applicationPackage).deferLoadBalancerProvisioningIn(Environment.test, Environment.staging, Environment.prod).deploy(); // Additional zone- and global-scoped endpoints are added (token) assertEquals(List.of("a9c8c045.cafed00d.g.vespa-app.cloud", @@ -1246,8 +1251,7 @@ public class RoutingPoliciesTest { .endpoint("foo", "c0") .endpoint("bar", "c0") .build(); - tester.provisionLoadBalancers(1, context.instanceId(), ZoneId.from("test", "aws-us-east-2c")); - tester.provisionLoadBalancers(1, context.instanceId(), ZoneId.from("staging", "aws-us-east-3c")); + tester.provisionLoadBalancers(1, context.instanceId(), testZonePublic, stagingZonePublic); context.submit(applicationPackage).deferLoadBalancerProvisioningIn(Environment.test, Environment.staging, Environment.prod).deploy(); List<String> expectedRecords = List.of("a9c8c045.cafed00d.g.vespa-app.cloud", "aa7591aa.cafed00d.g.vespa-app.cloud", @@ -1259,8 +1263,7 @@ public class RoutingPoliciesTest { assertEquals(expectedRecords, tester.recordNames()); // No change on redeployment - tester.provisionLoadBalancers(1, context.instanceId(), ZoneId.from("test", "aws-us-east-2c")); - tester.provisionLoadBalancers(1, context.instanceId(), ZoneId.from("staging", "aws-us-east-3c")); + tester.provisionLoadBalancers(1, context.instanceId(), testZonePublic, stagingZonePublic); context.submit(applicationPackage).deferLoadBalancerProvisioningIn(Environment.test, Environment.staging, Environment.prod).deploy(); assertEquals(expectedRecords, tester.recordNames()); } @@ -1281,8 +1284,7 @@ public class RoutingPoliciesTest { tester.provisionLoadBalancers(1, context.instanceId(), zone1); // ConfigServerMock provisions a load balancer for the "default" cluster, but in this scenario we need full // control over the load balancer name because "default" has no special treatment when using generated endpoints - tester.provisionLoadBalancers(1, context.instanceId(), ZoneId.from("test", "aws-us-east-2c")); - tester.provisionLoadBalancers(1, context.instanceId(), ZoneId.from("staging", "aws-us-east-3c")); + tester.provisionLoadBalancers(1, context.instanceId(), testZonePublic, stagingZonePublic); context.submit(applicationPackage).deferLoadBalancerProvisioningIn(Environment.test, Environment.staging, Environment.prod).deploy(); tester.assertTargets(context.instance().id(), EndpointId.of("foo"), ClusterSpec.Id.from("c0"), 0, Map.of(zone1, 1L), true); @@ -1297,8 +1299,7 @@ public class RoutingPoliciesTest { .container("c0", AuthMethod.mtls) .endpoint("foo", "c0") .build(); - tester.provisionLoadBalancers(1, context.instanceId(), ZoneId.from("test", "aws-us-east-2c")); - tester.provisionLoadBalancers(1, context.instanceId(), ZoneId.from("staging", "aws-us-east-3c")); + tester.provisionLoadBalancers(1, context.instanceId(), testZonePublic, stagingZonePublic); tester.provisionLoadBalancers(1, context.instanceId(), zone2); context.submit(applicationPackage).deferLoadBalancerProvisioningIn(Environment.test, Environment.staging, Environment.prod).deploy(); assertEquals(List.of("a6414896.cafed00d.aws-eu-west-1.w.vespa-app.cloud", @@ -1516,8 +1517,7 @@ public class RoutingPoliciesTest { } public RoutingPoliciesTester setEndpointConfig(EndpointConfig config) { - tester.controllerTester().flagSource().withBooleanFlag(Flags.LEGACY_ENDPOINTS.id(), config.supportsLegacy()); - tester.controllerTester().flagSource().withBooleanFlag(Flags.RANDOMIZED_ENDPOINT_NAMES.id(), config.supportsGenerated()); + tester.controllerTester().flagSource().withStringFlag(Flags.ENDPOINT_CONFIG.id(), config.name()); return this; } diff --git a/eval/src/vespa/eval/onnx/onnx_wrapper.h b/eval/src/vespa/eval/onnx/onnx_wrapper.h index 651461a45e6..205256079da 100644 --- a/eval/src/vespa/eval/onnx/onnx_wrapper.h +++ b/eval/src/vespa/eval/onnx/onnx_wrapper.h @@ -2,11 +2,7 @@ #pragma once -#ifdef __APPLE__ -#include <onnxruntime/core/session/onnxruntime_cxx_api.h> -#else #include <onnxruntime/onnxruntime_cxx_api.h> -#endif #include <vespa/vespalib/stllike/string.h> #include <vespa/eval/eval/value_type.h> #include <vespa/eval/eval/value.h> diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java index 56cd06d3b35..5baefefb72b 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -411,8 +411,8 @@ public class Flags { public static final UnboundStringFlag UNKNOWN_CONFIG_DEFINITION = defineStringFlag( "unknown-config-definition", "warn", - List.of("hmusum"), "2023-09-25", "2023-11-01", - "How to handle user config referencing unknown config definitions. Valid values are log, warn, fail", + List.of("hmusum"), "2023-09-25", "2023-11-15", + "How to handle user config referencing unknown config definitions. Valid values are 'warn' and 'fail'", "Takes effect at redeployment", INSTANCE_ID); @@ -434,7 +434,7 @@ public class Flags { List.of("mpolden", "tokle"), "2023-10-06", "2024-02-01", "Set the endpoint config to use for an application. Must be 'legacy', 'combined' or 'generated'. See EndpointConfig for further details", "Takes effect on next deployment through controller", - APPLICATION_ID); + TENANT_ID, APPLICATION_ID, INSTANCE_ID); /** WARNING: public for testing: All flags should be defined in {@link Flags}. */ public static UnboundBooleanFlag defineFeatureFlag(String flagId, boolean defaultValue, List<String> owners, diff --git a/messagebus/src/main/java/com/yahoo/messagebus/Routable.java b/messagebus/src/main/java/com/yahoo/messagebus/Routable.java index 06d92c48dd3..a94541ac5f6 100755 --- a/messagebus/src/main/java/com/yahoo/messagebus/Routable.java +++ b/messagebus/src/main/java/com/yahoo/messagebus/Routable.java @@ -10,7 +10,7 @@ import com.yahoo.text.Utf8String; * A routable can be regarded as a protocol-defined value with additional message bus related state. The state is what * differentiates two Routables that carry the same value. This includes the application context attached to the * routable and the {@link CallStack} used to track the path of the routable within messagebus. When a routable is - * copied (if the protocol supports it) only the value part is copied. The state must be explicitly transfered by + * copied (if the protocol supports it) only the value part is copied. The state must be explicitly transferred by * invoking the {@link #swapState(Routable)} method. That method is used to transfer the state from a message to the * corresponding reply, or to a different message if the application decides to replace it. * diff --git a/messagebus/src/main/java/com/yahoo/messagebus/Sequencer.java b/messagebus/src/main/java/com/yahoo/messagebus/Sequencer.java index 05e71e0f006..4e10a72c858 100644 --- a/messagebus/src/main/java/com/yahoo/messagebus/Sequencer.java +++ b/messagebus/src/main/java/com/yahoo/messagebus/Sequencer.java @@ -145,10 +145,10 @@ public class Sequencer implements MessageHandler, ReplyHandler { } private class SequencedSendTask implements Messenger.Task { - private final Message msg; + private Message msg; SequencedSendTask(Message msg) { this.msg = msg; } - @Override public void run() { sequencedSend(msg); } - @Override public void destroy() { } + @Override public void run() { sequencedSend(msg); msg = null; } + @Override public void destroy() { if (msg != null) msg.discard(); } } private void sendNextInSequence(long seqId) { diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeFailer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeFailer.java index 23e7fe16797..6c4be09c489 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeFailer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeFailer.java @@ -111,7 +111,7 @@ public class NodeFailer extends NodeRepositoryMaintainer { for (Node node : activeNodes) { Instant graceTimeStart = clock().instant().minus(nodeRepository().nodes().suspended(node) ? suspendedDownTimeLimit : downTimeLimit); - if (node.isDown() && node.history().hasEventBefore(History.Event.Type.down, graceTimeStart) && !applicationSuspended(node) && !undergoingCmr(node)) { + if (node.isDown() && node.history().hasEventBefore(History.Event.Type.down, graceTimeStart) && !applicationSuspended(node) && !affectedByMaintenance(node)) { // Allow a grace period after node re-activation if (!node.history().hasEventAfter(History.Event.Type.activated, graceTimeStart)) failingNodes.add(new FailingNode(node, "Node has been down longer than " + downTimeLimit)); @@ -146,7 +146,7 @@ public class NodeFailer extends NodeRepositoryMaintainer { /** Returns whether node has any kind of hardware issue */ static boolean hasHardwareIssue(Node node, NodeList allNodes) { Node host = node.parentHostname().flatMap(allNodes::node).orElse(node); - return reasonsToFailHost(host).size() > 0; + return !reasonsToFailHost(host).isEmpty(); } private boolean applicationSuspended(Node node) { @@ -159,17 +159,18 @@ public class NodeFailer extends NodeRepositoryMaintainer { } } - private boolean undergoingCmr(Node node) { + /** Is a maintenance event affecting this node? */ + private boolean affectedByMaintenance(Node node) { return node.reports().getReport("vcmr") - .map(report -> - SlimeUtils.entriesStream(report.getInspector().field("upcoming")) - .anyMatch(cmr -> { - var startTime = cmr.field("plannedStartTime").asLong(); - var endTime = cmr.field("plannedEndTime").asLong(); - var now = clock().instant().getEpochSecond(); - return now > startTime && now < endTime; - }) - ).orElse(false); + .map(report -> + SlimeUtils.entriesStream(report.getInspector().field("upcoming")) + .anyMatch(cmr -> { + var startTime = cmr.field("plannedStartTime").asLong(); + var endTime = cmr.field("plannedEndTime").asLong(); + var now = clock().instant().getEpochSecond(); + return now > startTime && now < endTime; + }) + ).orElse(false); } /** Is the node and all active children suspended? */ diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/NodeSerializer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/NodeSerializer.java index 40d8394142b..5efe5d8b2a8 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/NodeSerializer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/NodeSerializer.java @@ -283,7 +283,7 @@ public class NodeSerializer { SlimeUtils.optionalString(object.field(modelNameKey)), SlimeUtils.optionalString(object.field(reservedToKey)).map(TenantName::from), SlimeUtils.optionalString(object.field(exclusiveToApplicationIdKey)).map(ApplicationId::fromSerializedForm), - SlimeUtils.optionalString(object.field(exclusiveToApplicationIdKey)).map(ApplicationId::fromSerializedForm), // TODO: change to provisionedForApplicationIdKey + SlimeUtils.optionalString(object.field(provisionedForApplicationIdKey)).map(ApplicationId::fromSerializedForm), SlimeUtils.optionalDuration(object.field(hostTTLKey)), SlimeUtils.optionalInstant(object.field(hostEmptyAtKey)), SlimeUtils.optionalString(object.field(exclusiveToClusterTypeKey)).map(ClusterSpec.Type::from), diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/persistence/NodeSerializerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/persistence/NodeSerializerTest.java index 4aab8b683b0..0fbbefa39bb 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/persistence/NodeSerializerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/persistence/NodeSerializerTest.java @@ -483,7 +483,7 @@ public class NodeSerializerTest { ApplicationId provisionedForApp = ApplicationId.from("tenant1", "app1", "instance1"); node = nodeSerializer.fromJson(nodeSerializer.toJson(builder.exclusiveToApplicationId(provisionedForApp).build())); assertEquals(Optional.of(provisionedForApp), node.exclusiveToApplicationId()); - // assertEquals(Optional.empty(), node.provisionedForApplicationId()); TODO: enable once serialisation phase 1 is done + assertEquals(Optional.empty(), node.provisionedForApplicationId()); ClusterSpec.Type exclusiveToCluster = ClusterSpec.Type.admin; node = builder.provisionedForApplicationId(provisionedForApp) @@ -513,7 +513,7 @@ public class NodeSerializerTest { CloudAccount account = CloudAccount.from("012345678912"); Node node = Node.create("id", "host1.example.com", nodeFlavors.getFlavorOrThrow("default"), State.provisioned, NodeType.host) .cloudAccount(account) - .exclusiveToApplicationId(ApplicationId.defaultId()) + .provisionedForApplicationId(ApplicationId.defaultId()) .build(); node = nodeSerializer.fromJson(nodeSerializer.toJson(node)); assertEquals(account, node.cloudAccount()); diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiTest.java index 72c1e2e4ec3..9a7d2252b0e 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiTest.java @@ -1103,7 +1103,7 @@ public class NodesV2ApiTest { createIpAddresses(ipAddress) + "\"flavor\":\"" + flavor + "\"" + (reservedTo.map(tenantName -> ", \"reservedTo\":\"" + tenantName.value() + "\"").orElse("")) + - (exclusiveTo.map(appId -> ", \"exclusiveTo\":\"" + appId.serializedForm() + "\"").orElse("")) + + (exclusiveTo.map(appId -> ", \"provisionedFor\":\"" + appId.serializedForm() + "\"").orElse("")) + (switchHostname.map(s -> ", \"switchHostname\":\"" + s + "\"").orElse("")) + (additionalIpAddresses.isEmpty() ? "" : ", \"additionalIpAddresses\":[\"" + String.join("\",\"", additionalIpAddresses) + "\"]") + (additionalHostnames.isEmpty() ? "" : ", \"additionalHostnames\":[\"" + String.join("\",\"", additionalHostnames) + "\"]") + diff --git a/searchcore/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcore/src/vespa/searchcorespi/index/indexmaintainer.cpp index 50bbbaec355..bbd17be9b5a 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexmaintainer.cpp +++ b/searchcore/src/vespa/searchcorespi/index/indexmaintainer.cpp @@ -1362,7 +1362,6 @@ void IndexMaintainer::consider_initial_urgent_flush() { const Schema *prev_schema = nullptr; - std::optional<uint32_t> urgent_source_id; auto coll = getSourceCollection(); uint32_t count = coll->getSourceCount(); for (uint32_t i = 0; i < count; ++i) { |