summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2020-07-20 13:09:19 +0200
committerGitHub <noreply@github.com>2020-07-20 13:09:19 +0200
commit0120c3b992225f49aeb7396b4bbdcf78d6d83eb6 (patch)
treeeb8e922f6dda60df435c2347506035c08da7ef29
parentf11e22927b86725998507ad2eee262036f2c473d (diff)
parentd10891e79125ffe0f105552f51f147e85b2bd2ee (diff)
Merge pull request #13926 from vespa-engine/mpolden/global-endpoint-cluster
Expose the target cluster of an global endpoint in application API
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java52
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java126
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificateManager.java12
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java7
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java5
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/EndpointTest.java62
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/prod-us-central-1.json2
9 files changed, 144 insertions, 128 deletions
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 3b1926fa6e9..3a16cdb6143 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
@@ -5,6 +5,7 @@ import com.google.common.base.Suppliers;
import com.yahoo.component.Version;
import com.yahoo.config.application.api.DeploymentInstanceSpec;
import com.yahoo.config.provision.ApplicationId;
+import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.zone.RoutingMethod;
@@ -115,22 +116,23 @@ public class RoutingController {
var deployments = rotation.regions().stream()
.map(region -> new DeploymentId(instance.id(), ZoneId.from(Environment.prod, region)))
.collect(Collectors.toList());
- computeGlobalEndpoints(RoutingId.of(instance.id(), rotation.endpointId()),
+ computeGlobalEndpoints(RoutingId.of(instance.id(), rotation.endpointId()), rotation.clusterId(),
application, deployments).requiresRotation()
.forEach(endpoints::add);
}
// Add global endpoints provided by routing policies
- var deploymentsByRoutingId = new LinkedHashMap<RoutingId, List<DeploymentId>>();
+ var deploymentsByEndpointKey = new LinkedHashMap<EndpointKey, List<DeploymentId>>();
for (var policy : routingPolicies.get(instance.id()).values()) {
if (!policy.status().isActive()) continue;
for (var endpointId : policy.endpoints()) {
- var routingId = RoutingId.of(instance.id(), endpointId);
- deploymentsByRoutingId.putIfAbsent(routingId, new ArrayList<>());
- deploymentsByRoutingId.get(routingId).add(new DeploymentId(instance.id(), policy.id().zone()));
+ var endpointKey = new EndpointKey(RoutingId.of(instance.id(), endpointId), policy.id().cluster());
+ deploymentsByEndpointKey.computeIfAbsent(endpointKey, (k) -> new ArrayList<>())
+ .add(new DeploymentId(instance.id(), policy.id().zone()));
}
}
- deploymentsByRoutingId.forEach((routingId, deployments) -> {
- computeGlobalEndpoints(routingId, application, deployments).not().requiresRotation().forEach(endpoints::add);
+ deploymentsByEndpointKey.forEach((endpointKey, deployments) -> {
+ computeGlobalEndpoints(endpointKey.routingId, endpointKey.cluster, application,
+ deployments).not().requiresRotation().forEach(endpoints::add);
});
return EndpointList.copyOf(endpoints);
}
@@ -294,30 +296,30 @@ public class RoutingController {
}
/** Compute global endpoints for given routing ID, application and deployments */
- private EndpointList computeGlobalEndpoints(RoutingId routingId, Application application, List<DeploymentId> deployments) {
+ private EndpointList computeGlobalEndpoints(RoutingId routingId, ClusterSpec.Id cluster, Application application, List<DeploymentId> deployments) {
var endpoints = new ArrayList<Endpoint>();
var directMethods = 0;
- var targets = deployments.stream().map(DeploymentId::zoneId).collect(Collectors.toList());
+ var zones = deployments.stream().map(DeploymentId::zoneId).collect(Collectors.toList());
for (var method : routingMethodsOfAll(deployments, application)) {
if (method.isDirect() && ++directMethods > 1) {
throw new IllegalArgumentException("Invalid routing methods for " + routingId + ": Exceeded maximum " +
"direct methods");
}
endpoints.add(Endpoint.of(routingId.application())
- .named(routingId.endpointId(), targets)
+ .target(routingId.endpointId(), cluster, zones)
.on(Port.fromRoutingMethod(method))
.routingMethod(method)
.in(controller.system()));
// TODO(mpolden): Remove this once all applications have migrated away from legacy endpoints
if (method == RoutingMethod.shared) {
endpoints.add(Endpoint.of(routingId.application())
- .named(routingId.endpointId(), targets)
+ .target(routingId.endpointId(), cluster, zones)
.on(Port.plain(4080))
.legacy()
.routingMethod(method)
.in(controller.system()));
endpoints.add(Endpoint.of(routingId.application())
- .named(routingId.endpointId(), targets)
+ .target(routingId.endpointId(), cluster, zones)
.on(Port.tls(4443))
.legacy()
.routingMethod(method)
@@ -327,4 +329,30 @@ public class RoutingController {
return EndpointList.copyOf(endpoints);
}
+ private static class EndpointKey {
+
+ private final RoutingId routingId;
+ private final ClusterSpec.Id cluster;
+
+ public EndpointKey(RoutingId routingId, ClusterSpec.Id cluster) {
+ this.routingId = routingId;
+ this.cluster = cluster;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ EndpointKey that = (EndpointKey) o;
+ return routingId.equals(that.routingId) &&
+ cluster.equals(that.cluster);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(routingId, cluster);
+ }
+
+ }
+
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java
index 62804074337..aaaeb4218ec 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java
@@ -17,8 +17,8 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
- * Represents an application's endpoint. The endpoint scope can either be global or a specific zone. This is visible to
- * the tenant and is used by the tenant when accessing deployments.
+ * Represents an application's endpoint in hosted Vespa. This encapsulates all logic for building URLs and DNS names for
+ * application endpoints.
*
* @author mpolden
*/
@@ -29,7 +29,8 @@ public class Endpoint {
private static final String PUBLIC_DNS_SUFFIX = ".public.vespa.oath.cloud";
private static final String PUBLIC_CD_DNS_SUFFIX = ".public-cd.vespa.oath.cloud";
- private final String name;
+ private final EndpointId id;
+ private final ClusterSpec.Id cluster;
private final URI url;
private final List<ZoneId> zones;
private final Scope scope;
@@ -37,16 +38,20 @@ public class Endpoint {
private final RoutingMethod routingMethod;
private final boolean tls;
- private Endpoint(String name, URI url, List<ZoneId> zones, Scope scope, Port port, boolean legacy, RoutingMethod routingMethod) {
- Objects.requireNonNull(name, "name must be non-null");
+ private Endpoint(EndpointId id, ClusterSpec.Id cluster, URI url, List<ZoneId> zones, Scope scope, Port port, boolean legacy, RoutingMethod routingMethod) {
+ Objects.requireNonNull(cluster, "cluster must be non-null");
Objects.requireNonNull(zones, "zones must be non-null");
Objects.requireNonNull(scope, "scope must be non-null");
Objects.requireNonNull(port, "port must be non-null");
Objects.requireNonNull(routingMethod, "routingMethod must be non-null");
- if ((scope == Scope.zone || scope == Scope.weighted) && zones.size() != 1) {
- throw new IllegalArgumentException("A single zone must be given for " + scope + "-scoped endpoints");
+ if (scope == Scope.global) {
+ if (id == null) throw new IllegalArgumentException("Endpoint ID must be set for global endpoints");
+ } else {
+ if (id != null) throw new IllegalArgumentException("Endpoint ID cannot be set for " + scope + " endpoints");
+ if (zones.size() != 1) throw new IllegalArgumentException("A single zone must be given for " + scope + " endpoints");
}
- this.name = name;
+ this.id = id;
+ this.cluster = cluster;
this.url = url;
this.zones = List.copyOf(zones);
this.scope = scope;
@@ -55,10 +60,11 @@ public class Endpoint {
this.tls = port.tls;
}
- private Endpoint(String name, ApplicationId application, List<ZoneId> zones, Scope scope, SystemName system,
+ private Endpoint(EndpointId id, ClusterSpec.Id cluster, ApplicationId application, List<ZoneId> zones, Scope scope, SystemName system,
Port port, boolean legacy, RoutingMethod routingMethod) {
- this(name,
- createUrl(name,
+ this(id,
+ cluster,
+ createUrl(endpointOrClusterAsString(id, cluster),
Objects.requireNonNull(application, "application must be non-null"),
zones,
scope,
@@ -70,14 +76,19 @@ public class Endpoint {
}
/**
- * Returns the name of this endpoint (the first component of the DNS name). Depending on the endpoint type, this
- * can be one of the following:
- * - A wildcard (any scope)
- * - A cluster name (only zone scope)
- * - An endpoint ID (only global scope)
+ * Returns the name of this endpoint (the first component of the DNS name). This can be one of the following:
+ *
+ * - The wildcard character '*' (for wildcard endpoints, with any scope)
+ * - The cluster ID (zone scope)
+ * - The endpoint ID (global scope)
*/
public String name() {
- return name;
+ return endpointOrClusterAsString(id, cluster);
+ }
+
+ /** Returns the cluster ID to which this routes traffic */
+ public ClusterSpec.Id cluster() {
+ return cluster;
}
/** Returns the URL used to access this */
@@ -106,7 +117,7 @@ public class Endpoint {
return legacy;
}
- /** Returns the routing used for this */
+ /** Returns the routing method used for this */
public RoutingMethod routingMethod() {
return routingMethod;
}
@@ -125,7 +136,7 @@ public class Endpoint {
public String upstreamIdOf(DeploymentId deployment) {
if (scope != Scope.global) throw new IllegalArgumentException("Scope " + scope + " does not have upstream name");
if (!routingMethod.isShared()) throw new IllegalArgumentException("Routing method " + routingMethod + " does not have upstream name");
- return upstreamIdOf(name, deployment.applicationId(), deployment.zoneId());
+ return upstreamIdOf(name(), deployment.applicationId(), deployment.zoneId());
}
@Override
@@ -151,6 +162,10 @@ public class Endpoint {
return dnsSuffix(system, false);
}
+ private static String endpointOrClusterAsString(EndpointId id, ClusterSpec.Id cluster) {
+ return id == null ? cluster.value() : id.id();
+ }
+
private static URI createUrl(String name, ApplicationId application, List<ZoneId> zones, Scope scope,
SystemName system, Port port, boolean legacy, RoutingMethod routingMethod) {
String scheme = port.tls ? "https" : "http";
@@ -323,7 +338,7 @@ public class Endpoint {
if (!systemApplication.hasEndpoint()) throw new IllegalArgumentException(systemApplication + " has no endpoint");
RoutingMethod routingMethod = RoutingMethod.exclusive;
Port port = url.getPort() == -1 ? Port.tls() : Port.tls(url.getPort()); // System application endpoints are always TLS
- return new Endpoint("", url, List.of(zone), Scope.zone, port, false, routingMethod);
+ return new Endpoint(null, ClusterSpec.Id.from("admin"), url, List.of(zone), Scope.zone, port, false, routingMethod);
}
public static class EndpointBuilder {
@@ -337,60 +352,55 @@ public class Endpoint {
private Port port;
private RoutingMethod routingMethod = RoutingMethod.shared;
private boolean legacy = false;
- private boolean wildcard = false;
private EndpointBuilder(ApplicationId application) {
this.application = application;
}
- /** Sets the cluster target for this */
+ /** Sets the zone target for this */
public EndpointBuilder target(ClusterSpec.Id cluster, ZoneId zone) {
- if (endpointId != null || wildcard) {
- throw new IllegalArgumentException("Cannot set multiple target types");
- }
+ checkScope();
this.cluster = cluster;
this.scope = Scope.zone;
this.zones = List.of(zone);
return this;
}
- /** Sets the endpoint target ID for this (as defined in deployments.xml) */
- public EndpointBuilder named(EndpointId endpointId) {
- return named(endpointId, List.of());
+ /** Sets the global target with given ID and pointing to the default cluster */
+ public EndpointBuilder target(EndpointId endpointId) {
+ return target(endpointId, ClusterSpec.Id.from("default"), List.of());
}
- /** Sets the endpoint ID for this (as defined in deployments.xml) */
- public EndpointBuilder named(EndpointId endpointId, List<ZoneId> targets) {
- if (cluster != null || wildcard) {
- throw new IllegalArgumentException("Cannot set multiple target types");
- }
+ /** Sets the global target with given ID, zones and cluster (as defined in deployments.xml) */
+ public EndpointBuilder target(EndpointId endpointId, ClusterSpec.Id cluster, List<ZoneId> zones) {
+ checkScope();
this.endpointId = endpointId;
- this.zones = targets;
+ this.cluster = cluster;
+ this.zones = zones;
this.scope = Scope.global;
return this;
}
/** Sets the global wildcard target for this */
public EndpointBuilder wildcard() {
- return wildcard(Scope.global, List.of());
+ return target(EndpointId.of("*"), ClusterSpec.Id.from("*"), List.of());
}
/** Sets the zone wildcard target for this */
public EndpointBuilder wildcard(ZoneId zone) {
- return wildcard(Scope.zone, List.of(zone));
+ return target(ClusterSpec.Id.from("*"), zone);
}
- private EndpointBuilder wildcard(Scope scope, List<ZoneId> zones) {
- if (endpointId != null || cluster != null) {
- throw new IllegalArgumentException("Cannot set multiple target types");
- }
- this.wildcard = true;
- this.scope = scope;
- this.zones = zones;
+ /** Sets the weighted target for this */
+ public EndpointBuilder weighted(ClusterSpec.Id cluster, ZoneId zone) {
+ checkScope();
+ this.cluster = cluster;
+ this.scope = Scope.weighted;
+ this.zones = List.of(effectiveZone(zone));
return this;
}
- /** Sets the port of this */
+ /** Sets the port of this */
public EndpointBuilder on(Port port) {
this.port = port;
return this;
@@ -408,35 +418,21 @@ public class Endpoint {
return this;
}
- /** Make this a weighted endpoint */
- public EndpointBuilder weighted() {
- if (scope != Scope.zone && scope != Scope.weighted) {
- throw new IllegalArgumentException("Endpoint must target zone before making it weighted");
- }
- this.scope = Scope.weighted;
- this.zones = List.of(effectiveZone(zones.get(0)));
- return this;
- }
-
/** Sets the system that owns this */
public Endpoint in(SystemName system) {
- String name;
- if (wildcard) {
- name = "*";
- } else if (endpointId != null) {
- name = endpointId.id();
- } else if (cluster != null) {
- name = cluster.value();
- } else {
- throw new IllegalArgumentException("Must set either cluster, rotation or wildcard target");
- }
if (system.isPublic() && routingMethod != RoutingMethod.exclusive) {
throw new IllegalArgumentException("Public system only supports routing method " + RoutingMethod.exclusive);
}
if (routingMethod.isDirect() && !port.isDefault()) {
throw new IllegalArgumentException("Routing method " + routingMethod + " can only use default port");
}
- return new Endpoint(name, application, zones, scope, system, port, legacy, routingMethod);
+ return new Endpoint(endpointId, cluster, application, zones, scope, system, port, legacy, routingMethod);
+ }
+
+ private void checkScope() {
+ if (scope != null) {
+ throw new IllegalArgumentException("Cannot change endpoint scope. Already set to " + scope);
+ }
}
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificateManager.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificateManager.java
index 425364f6741..1cf42cf0073 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificateManager.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificateManager.java
@@ -12,10 +12,6 @@ import com.yahoo.config.provision.zone.ZoneApi;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.container.jdisc.secretstore.SecretNotFoundException;
import com.yahoo.container.jdisc.secretstore.SecretStore;
-
-import java.util.LinkedHashSet;
-import java.util.logging.Level;
-
import com.yahoo.security.SubjectAlternativeName;
import com.yahoo.security.X509CertificateUtils;
import com.yahoo.vespa.flags.BooleanFlag;
@@ -24,8 +20,8 @@ import com.yahoo.vespa.flags.FlagSource;
import com.yahoo.vespa.flags.Flags;
import com.yahoo.vespa.flags.StringFlag;
import com.yahoo.vespa.hosted.controller.Instance;
-import com.yahoo.vespa.hosted.controller.api.integration.certificates.EndpointCertificateProvider;
import com.yahoo.vespa.hosted.controller.api.integration.certificates.EndpointCertificateMetadata;
+import com.yahoo.vespa.hosted.controller.api.integration.certificates.EndpointCertificateProvider;
import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry;
import com.yahoo.vespa.hosted.controller.application.Endpoint;
import com.yahoo.vespa.hosted.controller.application.EndpointId;
@@ -41,6 +37,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -48,6 +45,7 @@ import java.util.OptionalInt;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
@@ -303,8 +301,8 @@ public class EndpointCertificateManager {
List<Endpoint.EndpointBuilder> endpoints = new ArrayList<>();
- if(zone.environment().isProduction()) {
- endpoints.add(Endpoint.of(applicationId).named(EndpointId.defaultId()));
+ if (zone.environment().isProduction()) {
+ endpoints.add(Endpoint.of(applicationId).target(EndpointId.defaultId()));
endpoints.add(Endpoint.of(applicationId).wildcard());
}
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 dc3c14c76b7..f2897f856ce 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
@@ -971,7 +971,9 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
// Add zone endpoints
var endpointArray = response.setArray("endpoints");
- for (var endpoint : controller.routing().endpointsOf(deploymentId).scope(Endpoint.Scope.zone)) {
+ for (var endpoint : controller.routing().endpointsOf(deploymentId)
+ .scope(Endpoint.Scope.zone)
+ .not().legacy()) {
toSlime(endpoint, endpoint.name(), endpointArray.addObject());
}
// Add global endpoints
@@ -979,8 +981,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
.not().legacy()
.targets(deploymentId.zoneId());
for (var endpoint : globalEndpoints) {
- // TODO(mpolden): Pass cluster name. Cluster that a global endpoint points to is not available at this level.
- toSlime(endpoint, "", endpointArray.addObject());
+ toSlime(endpoint, endpoint.cluster().value(), endpointArray.addObject());
}
response.setString("nodes", withPath("/zone/v2/" + deploymentId.zoneId().environment() + "/" + deploymentId.zoneId().region() + "/nodes/v2/node/?&recursive=true&application=" + deploymentId.applicationId().tenant() + "." + deploymentId.applicationId().application() + "." + deploymentId.applicationId().instance(), request.getUri()).toString());
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java
index 7f4a707949b..337e2b897f1 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java
@@ -74,12 +74,12 @@ public class RoutingPolicy {
Optional<Endpoint> infraEndpoint = SystemApplication.matching(id.owner())
.flatMap(app -> app.endpointIn(id.zone(), zoneRegistry));
if (infraEndpoint.isPresent()) return infraEndpoint.get();
- return endpoint(routingMethod).in(system);
+ return endpoint(routingMethod).target(id.cluster(), id.zone()).in(system);
}
/** Returns the weighted endpoint of this */
public Endpoint weightedEndpointIn(SystemName system, RoutingMethod routingMethod) {
- return endpoint(routingMethod).weighted().in(system);
+ return endpoint(routingMethod).weighted(id.cluster(), id.zone()).in(system);
}
@Override
@@ -104,7 +104,6 @@ public class RoutingPolicy {
private Endpoint.EndpointBuilder endpoint(RoutingMethod routingMethod) {
return Endpoint.of(id.owner())
- .target(id.cluster(), id.zone())
.on(Port.fromRoutingMethod(routingMethod))
.routingMethod(routingMethod);
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/EndpointTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/EndpointTest.java
index 2e57a5eaaa1..2f4c9af54c3 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/EndpointTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/EndpointTest.java
@@ -29,43 +29,43 @@ public class EndpointTest {
Map<String, Endpoint> tests = Map.of(
// Legacy endpoint
"http://a1.t1.global.vespa.yahooapis.com:4080/",
- Endpoint.of(app1).named(endpointId).on(Port.plain(4080)).legacy().in(SystemName.main),
+ Endpoint.of(app1).target(endpointId).on(Port.plain(4080)).legacy().in(SystemName.main),
// Legacy endpoint with TLS
"https://a1--t1.global.vespa.yahooapis.com:4443/",
- Endpoint.of(app1).named(endpointId).on(Port.tls(4443)).legacy().in(SystemName.main),
+ Endpoint.of(app1).target(endpointId).on(Port.tls(4443)).legacy().in(SystemName.main),
// Main endpoint
"https://a1--t1.global.vespa.oath.cloud:4443/",
- Endpoint.of(app1).named(endpointId).on(Port.tls(4443)).in(SystemName.main),
+ Endpoint.of(app1).target(endpointId).on(Port.tls(4443)).in(SystemName.main),
// Main endpoint in CD
"https://cd--a1--t1.global.vespa.oath.cloud:4443/",
- Endpoint.of(app1).named(endpointId).on(Port.tls(4443)).in(SystemName.cd),
+ Endpoint.of(app1).target(endpointId).on(Port.tls(4443)).in(SystemName.cd),
// Main endpoint in CD
"https://cd--i2--a2--t2.global.vespa.oath.cloud:4443/",
- Endpoint.of(app2).named(endpointId).on(Port.tls(4443)).in(SystemName.cd),
+ Endpoint.of(app2).target(endpointId).on(Port.tls(4443)).in(SystemName.cd),
// Main endpoint with direct routing and default TLS port
"https://a1.t1.global.vespa.oath.cloud/",
- Endpoint.of(app1).named(endpointId).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
+ Endpoint.of(app1).target(endpointId).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
// Main endpoint with custom rotation name
"https://r1.a1.t1.global.vespa.oath.cloud/",
- Endpoint.of(app1).named(EndpointId.of("r1")).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
+ Endpoint.of(app1).target(EndpointId.of("r1")).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
// Main endpoint for custom instance in default rotation
"https://i2.a2.t2.global.vespa.oath.cloud/",
- Endpoint.of(app2).named(endpointId).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
+ Endpoint.of(app2).target(endpointId).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
// Main endpoint for custom instance with custom rotation name
"https://r2.i2.a2.t2.global.vespa.oath.cloud/",
- Endpoint.of(app2).named(EndpointId.of("r2")).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
+ Endpoint.of(app2).target(EndpointId.of("r2")).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
// Main endpoint in public system
"https://a1.t1.global.public.vespa.oath.cloud/",
- Endpoint.of(app1).named(endpointId).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.Public)
+ Endpoint.of(app1).target(endpointId).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.Public)
);
tests.forEach((expected, endpoint) -> assertEquals(expected, endpoint.url().toString()));
}
@@ -77,43 +77,43 @@ public class EndpointTest {
Map<String, Endpoint> tests = Map.of(
// Legacy endpoint
"http://a1.t1.global.vespa.yahooapis.com:4080/",
- Endpoint.of(app1).named(endpointId).on(Port.plain(4080)).legacy().in(SystemName.main),
+ Endpoint.of(app1).target(endpointId).on(Port.plain(4080)).legacy().in(SystemName.main),
// Legacy endpoint with TLS
"https://a1--t1.global.vespa.yahooapis.com:4443/",
- Endpoint.of(app1).named(endpointId).on(Port.tls(4443)).legacy().in(SystemName.main),
+ Endpoint.of(app1).target(endpointId).on(Port.tls(4443)).legacy().in(SystemName.main),
// Main endpoint
"https://a1--t1.global.vespa.oath.cloud:4443/",
- Endpoint.of(app1).named(endpointId).on(Port.tls(4443)).in(SystemName.main),
+ Endpoint.of(app1).target(endpointId).on(Port.tls(4443)).in(SystemName.main),
// Main endpoint in CD
"https://cd--i2--a2--t2.global.vespa.oath.cloud:4443/",
- Endpoint.of(app2).named(endpointId).on(Port.tls(4443)).in(SystemName.cd),
+ Endpoint.of(app2).target(endpointId).on(Port.tls(4443)).in(SystemName.cd),
// Main endpoint in CD
"https://cd--a1--t1.global.vespa.oath.cloud:4443/",
- Endpoint.of(app1).named(endpointId).on(Port.tls(4443)).in(SystemName.cd),
+ Endpoint.of(app1).target(endpointId).on(Port.tls(4443)).in(SystemName.cd),
// Main endpoint with direct routing and default TLS port
"https://a1.t1.global.vespa.oath.cloud/",
- Endpoint.of(app1).named(endpointId).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
+ Endpoint.of(app1).target(endpointId).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
// Main endpoint with custom rotation name
"https://r1.a1.t1.global.vespa.oath.cloud/",
- Endpoint.of(app1).named(EndpointId.of("r1")).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
+ Endpoint.of(app1).target(EndpointId.of("r1")).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
// Main endpoint for custom instance in default rotation
"https://i2.a2.t2.global.vespa.oath.cloud/",
- Endpoint.of(app2).named(endpointId).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
+ Endpoint.of(app2).target(endpointId).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
// Main endpoint for custom instance with custom rotation name
"https://r2.i2.a2.t2.global.vespa.oath.cloud/",
- Endpoint.of(app2).named(EndpointId.of("r2")).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
+ Endpoint.of(app2).target(EndpointId.of("r2")).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.main),
// Main endpoint in public system
"https://a1.t1.global.public.vespa.oath.cloud/",
- Endpoint.of(app1).named(endpointId).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.Public)
+ Endpoint.of(app1).target(endpointId).on(Port.tls()).routingMethod(RoutingMethod.exclusive).in(SystemName.Public)
);
tests.forEach((expected, endpoint) -> assertEquals(expected, endpoint.url().toString()));
}
@@ -178,7 +178,7 @@ public class EndpointTest {
// Default rotation
"https://a1.t1.global.public.vespa.oath.cloud/",
Endpoint.of(app1)
- .named(EndpointId.defaultId())
+ .target(EndpointId.defaultId())
.routingMethod(RoutingMethod.exclusive)
.on(Port.tls())
.in(SystemName.Public),
@@ -233,30 +233,26 @@ public class EndpointTest {
Map<String, Endpoint> tests = Map.of(
"https://a1.t1.us-north-1-w.public.vespa.oath.cloud/",
Endpoint.of(app1)
- .target(cluster, ZoneId.from("prod", "us-north-1a"))
- .weighted()
+ .weighted(cluster, ZoneId.from("prod", "us-north-1a"))
.routingMethod(RoutingMethod.exclusive)
.on(Port.tls())
.in(SystemName.Public),
"https://a1.t1.us-north-2-w.public.vespa.oath.cloud/",
Endpoint.of(app1)
- .target(cluster, ZoneId.from("prod", "us-north-2"))
- .weighted()
+ .weighted(cluster, ZoneId.from("prod", "us-north-2"))
.routingMethod(RoutingMethod.exclusive)
.on(Port.tls())
.in(SystemName.Public),
"https://a1.t1.us-north-2-w.test.public.vespa.oath.cloud/",
Endpoint.of(app1)
- .target(cluster, ZoneId.from("test", "us-north-2"))
- .weighted()
+ .weighted(cluster, ZoneId.from("test", "us-north-2"))
.routingMethod(RoutingMethod.exclusive)
.on(Port.tls())
.in(SystemName.Public)
);
tests.forEach((expected, endpoint) -> assertEquals(expected, endpoint.url().toString()));
Endpoint endpoint = Endpoint.of(app1)
- .target(cluster, ZoneId.from("prod", "us-north-1a"))
- .weighted()
+ .weighted(cluster, ZoneId.from("prod", "us-north-1a"))
.routingMethod(RoutingMethod.exclusive)
.on(Port.tls())
.in(SystemName.main);
@@ -271,20 +267,20 @@ public class EndpointTest {
var tests1 = Map.of(
// With default cluster
"a1.t1.us-north-1.prod",
- Endpoint.of(app1).named(EndpointId.defaultId()).on(Port.tls(4443)).in(SystemName.main),
+ Endpoint.of(app1).target(EndpointId.defaultId()).on(Port.tls(4443)).in(SystemName.main),
// With non-default cluster
"c1.a1.t1.us-north-1.prod",
- Endpoint.of(app1).named(EndpointId.of("c1")).on(Port.tls(4443)).in(SystemName.main)
+ Endpoint.of(app1).target(EndpointId.of("c1")).on(Port.tls(4443)).in(SystemName.main)
);
var tests2 = Map.of(
// With non-default instance
"i2.a2.t2.us-north-1.prod",
- Endpoint.of(app2).named(EndpointId.defaultId()).on(Port.tls(4443)).in(SystemName.main),
+ Endpoint.of(app2).target(EndpointId.defaultId()).on(Port.tls(4443)).in(SystemName.main),
// With non-default instance and cluster
"c2.i2.a2.t2.us-north-1.prod",
- Endpoint.of(app2).named(EndpointId.of("c2")).on(Port.tls(4443)).in(SystemName.main)
+ Endpoint.of(app2).target(EndpointId.of("c2")).on(Port.tls(4443)).in(SystemName.main)
);
tests1.forEach((expected, endpoint) -> assertEquals(expected, endpoint.upstreamIdOf(new DeploymentId(app1, zone))));
tests2.forEach((expected, endpoint) -> assertEquals(expected, endpoint.upstreamIdOf(new DeploymentId(app2, zone))));
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java
index 6a12c4457db..2e8b3e46a87 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java
@@ -2,7 +2,6 @@
package com.yahoo.vespa.hosted.controller.deployment;
import com.yahoo.config.provision.ApplicationId;
-import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.slime.SlimeUtils;
@@ -12,7 +11,6 @@ import com.yahoo.vespa.hosted.controller.application.EndpointId;
import org.junit.Test;
import java.io.IOException;
-import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
@@ -33,7 +31,7 @@ public class TestConfigSerializerTest {
JobType.systemTest,
true,
Map.of(zone, List.of(Endpoint.of(ApplicationId.defaultId())
- .named(EndpointId.of("ai"))
+ .target(EndpointId.of("ai"))
.on(Endpoint.Port.tls())
.in(SystemName.main))),
Map.of(zone, List.of("facts")));
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json
index 928525a20d1..c74092c4ae8 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json
@@ -13,7 +13,7 @@
"routingMethod": "shared"
},
{
- "cluster": "",
+ "cluster": "foo",
"tls": true,
"url": "https://instance1--application1--tenant1.global.vespa.oath.cloud:4443/",
"scope": "global",
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/prod-us-central-1.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/prod-us-central-1.json
index 4ffe809297d..7d2def6c479 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/prod-us-central-1.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/prod-us-central-1.json
@@ -16,7 +16,7 @@
"routingMethod": "shared"
},
{
- "cluster": "",
+ "cluster": "foo",
"tls": true,
"url": "https://instance1--application1--tenant1.global.vespa.oath.cloud:4443/",
"scope": "global",