diff options
author | Martin Polden <mpolden@mpolden.no> | 2023-10-11 11:03:24 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2023-10-11 13:56:17 +0200 |
commit | 2d4a465fd170c8624d2d481b66f7105ddd5d16c5 (patch) | |
tree | ca1fef96e638c95334cb7e56ad89f0e6a37f24c3 /config-model/src/main/java | |
parent | abac62c851c27907c7a77c6ca5c7566fdbe64b75 (diff) |
Require zone-scoped endpoint in config-model
Diffstat (limited to 'config-model/src/main/java')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java index 7b34c16b8a2..9821f3b9568 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java @@ -17,6 +17,7 @@ import com.yahoo.config.model.deploy.DeployState; import com.yahoo.config.model.producer.TreeConfigProducer; import com.yahoo.config.provision.AllocatedHosts; import com.yahoo.config.provision.HostSpec; +import com.yahoo.config.provision.TenantName; import com.yahoo.container.bundle.BundleInstantiationSpecification; import com.yahoo.container.di.config.ApplicationBundlesConfig; import com.yahoo.container.handler.metrics.MetricsProxyApiConfig; @@ -78,6 +79,8 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat private static final BindingPattern PROMETHEUS_V1_HANDLER_BINDING_1 = SystemBindingPattern.fromHttpPath(PrometheusV1Handler.V1_PATH); private static final BindingPattern PROMETHEUS_V1_HANDLER_BINDING_2 = SystemBindingPattern.fromHttpPath(PrometheusV1Handler.V1_PATH + "/*"); + private static final TenantName HOSTED_VESPA = TenantName.from("hosted-vespa"); + public static final int defaultHeapSizePercentageOfAvailableMemory = 85; public static final int heapSizePercentageOfTotalAvailableMemoryWhenCombinedCluster = 24; @@ -223,8 +226,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat /** Create list of endpoints, these will be consumed later by LbServicesProducer */ private void createEndpoints(DeployState deployState) { - if (!deployState.isHosted()) return; - if (deployState.getProperties().applicationId().instance().isTester()) return; + if (!configureEndpoints(deployState)) return; // Add endpoints provided by the controller List<String> hosts = getContainers().stream().map(AbstractService::getHostName).sorted().toList(); List<ApplicationClusterEndpoint> endpoints = new ArrayList<>(); @@ -241,6 +243,12 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat .authMethod(ce.authMethod()) .build()) )); + if (endpoints.stream().noneMatch(endpoint -> endpoint.scope() == ApplicationClusterEndpoint.Scope.zone)) { + throw new IllegalArgumentException("Expected at least one " + ApplicationClusterEndpoint.Scope.zone + + " endpoint for cluster '" + name() + "' in application '" + + deployState.getProperties().applicationId() + + "', got " + deployState.getEndpoints()); + } this.endpoints = Collections.unmodifiableList(endpoints); } @@ -374,6 +382,14 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat public OnnxModelCost.Calculator onnxModelCost() { return onnxModelCost; } + /** Returns whether the deployment in given deploy state should have endpoints */ + private static boolean configureEndpoints(DeployState deployState) { + if (!deployState.isHosted()) return false; + if (deployState.getProperties().applicationId().instance().isTester()) return false; + if (deployState.getProperties().applicationId().tenant().equals(HOSTED_VESPA)) return false; + return true; + } + public static class MbusParams { // the amount of the maxpendingbytes to process concurrently, typically 0.2 (20%) final Double maxConcurrentFactor; |