aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2023-08-24 15:22:10 +0200
committerMartin Polden <mpolden@mpolden.no>2023-08-24 15:22:10 +0200
commitba2e6204b350c80d6ed2f84d71b36011fdfa3b52 (patch)
treed1127d3b2567e48388529bb47835ea83df07a271 /config-model
parentf5d7c59226176a53793ea392debd399197f55689 (diff)
Use zone-scoped endpoints from controller when present
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java37
1 files changed, 20 insertions, 17 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 3c1c4867f13..584207caeac 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
@@ -199,33 +199,36 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat
/** Create list of endpoints, these will be consumed later by LbServicesProducer */
private void createEndpointList(DeployState deployState) {
- if(!deployState.isHosted()) return;
- if(deployState.getProperties().applicationId().instance().isTester()) return;
+ if (!deployState.isHosted()) return;
+ if (deployState.getProperties().applicationId().instance().isTester()) return;
List<ApplicationClusterEndpoint> endpoints = new ArrayList<>();
- // Add zone local endpoints using zone dns suffixes, tenant, application and cluster id.
List<String> hosts = getContainers().stream()
.map(AbstractService::getHostName)
.sorted()
.toList();
- for (String suffix : deployState.getProperties().zoneDnsSuffixes()) {
- ApplicationClusterEndpoint.DnsName l4Name = ApplicationClusterEndpoint.DnsName.sharedL4NameFrom(
- deployState.zone().system(),
- ClusterSpec.Id.from(getName()),
- deployState.getProperties().applicationId(),
- suffix);
- endpoints.add(ApplicationClusterEndpoint.builder()
- .zoneScope()
- .sharedL4Routing()
- .dnsName(l4Name)
- .hosts(hosts)
- .clusterId(getName())
- .build());
+ Set<ContainerEndpoint> endpointsFromController = deployState.getEndpoints();
+ // Add zone-scoped endpoints if not provided by the controller
+ // TODO(mpolden): Remove this when controller always includes zone-scope endpoints, and config models < 8.230 are gone
+ if (endpointsFromController.stream().noneMatch(endpoint -> endpoint.scope() == ApplicationClusterEndpoint.Scope.zone)) {
+ for (String suffix : deployState.getProperties().zoneDnsSuffixes()) {
+ ApplicationClusterEndpoint.DnsName l4Name = ApplicationClusterEndpoint.DnsName.sharedL4NameFrom(
+ deployState.zone().system(),
+ ClusterSpec.Id.from(getName()),
+ deployState.getProperties().applicationId(),
+ suffix);
+ endpoints.add(ApplicationClusterEndpoint.builder()
+ .zoneScope()
+ .sharedL4Routing()
+ .dnsName(l4Name)
+ .hosts(hosts)
+ .clusterId(getName())
+ .build());
+ }
}
// Include all endpoints provided by controller
- Set<ContainerEndpoint> endpointsFromController = deployState.getEndpoints();
endpointsFromController.stream()
.filter(ce -> ce.clusterId().equals(getName()))
.filter(ce -> ce.routingMethod() == sharedLayer4)