aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/DeploymentData.java6
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ContainerEndpoint.java16
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java158
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java21
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/EndpointList.java7
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java6
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java14
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/routing/RoutingApiHandler.java2
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java9
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java88
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java21
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java8
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java12
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java8
15 files changed, 127 insertions, 252 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/DeploymentData.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/DeploymentData.java
index ad98197fa93..1f1f8577a32 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/DeploymentData.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/DeploymentData.java
@@ -64,13 +64,13 @@ public class DeploymentData {
this.zone = requireNonNull(zone);
this.applicationPackage = requireNonNull(applicationPackage);
this.platform = requireNonNull(platform);
- this.containerEndpoints = Set.copyOf(requireNonNull(containerEndpoints));
+ this.containerEndpoints = requireNonNull(containerEndpoints);
this.endpointCertificateMetadata = requireNonNull(endpointCertificateMetadata);
this.dockerImageRepo = requireNonNull(dockerImageRepo);
this.athenzDomain = athenzDomain;
this.quota = quota;
- this.tenantSecretStores = List.copyOf(requireNonNull(tenantSecretStores));
- this.operatorCertificates = List.copyOf(requireNonNull(operatorCertificates));
+ this.tenantSecretStores = tenantSecretStores;
+ this.operatorCertificates = operatorCertificates;
this.dryRun = dryRun;
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ContainerEndpoint.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ContainerEndpoint.java
index bac34e73dc5..3e9169a83aa 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ContainerEndpoint.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ContainerEndpoint.java
@@ -12,12 +12,10 @@ import java.util.Objects;
public class ContainerEndpoint {
private final String clusterId;
- private final String scope;
private final List<String> names;
- public ContainerEndpoint(String clusterId, String scope, List<String> names) {
+ public ContainerEndpoint(String clusterId, List<String> names) {
this.clusterId = nonEmpty(clusterId, "message must be non-empty");
- this.scope = Objects.requireNonNull(scope, "scope must be non-null");
this.names = List.copyOf(Objects.requireNonNull(names, "names must be non-null"));
}
@@ -26,11 +24,6 @@ public class ContainerEndpoint {
return clusterId;
}
- /** The scope of this endpoint */
- public String scope() {
- return scope;
- }
-
/**
* All valid DNS names for this endpoint. This can contain both proper DNS names and synthetic identifiers used for
* routing, such as a Host header value that is not necessarily a proper DNS name.
@@ -44,17 +37,18 @@ public class ContainerEndpoint {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ContainerEndpoint that = (ContainerEndpoint) o;
- return clusterId.equals(that.clusterId) && scope.equals(that.scope) && names.equals(that.names);
+ return clusterId.equals(that.clusterId) &&
+ names.equals(that.names);
}
@Override
public int hashCode() {
- return Objects.hash(clusterId, scope, names);
+ return Objects.hash(clusterId, names);
}
@Override
public String toString() {
- return "container endpoint for " + clusterId + ": " + names + " [scope=" + scope + "]";
+ return "container endpoint for " + clusterId + " " + names;
}
private static String nonEmpty(String s, String message) {
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java
index 893b7a1b1dc..852570b9ed4 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java
@@ -42,9 +42,6 @@ public interface ZoneRegistry {
/** Returns the URI for the config server VIP in the given zone */
URI getConfigServerVipUri(ZoneId zoneId);
- /** Returns the VIP hostname for the shared routing layer in given zone, if any */
- Optional<String> getVipHostname(ZoneId zoneId);
-
/** Returns the time to live for deployments in the given zone, or empty if this is infinite */
Optional<Duration> getDeploymentTimeToLive(ZoneId zoneId);
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 6e3a303f7e5..5d02302795d 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
@@ -86,8 +86,8 @@ public class RoutingController {
return rotationRepository;
}
- /** Read and return zone-scoped endpoints for given deployment */
- public EndpointList readEndpointsOf(DeploymentId deployment) {
+ /** Returns endpoints for given deployment */
+ public EndpointList endpointsOf(DeploymentId deployment) {
Set<Endpoint> endpoints = new LinkedHashSet<>();
boolean isSystemApplication = SystemApplication.matching(deployment.applicationId()).isPresent();
// Avoid reading application more than once per call to this
@@ -104,52 +104,53 @@ public class RoutingController {
return EndpointList.copyOf(endpoints);
}
- /** Read application and return declared endpoints for given instance */
- public EndpointList readDeclaredEndpointsOf(ApplicationId instance) {
+ /** Returns global-scoped endpoints for given instance */
+ public EndpointList endpointsOf(ApplicationId instance) {
if (SystemApplication.matching(instance).isPresent()) return EndpointList.EMPTY;
- return readDeclaredEndpointsOf(TenantAndApplicationId.from(instance)).instance(instance.instance());
+ return endpointsOf(controller.applications().requireApplication(TenantAndApplicationId.from(instance)),
+ instance.instance());
}
- /** Read application and return declared endpoints for given application */
- public EndpointList readDeclaredEndpointsOf(TenantAndApplicationId application) {
- return declaredEndpointsOf(controller.applications().requireApplication(application));
+ /** Returns global-scoped endpoints for given instance */
+ public EndpointList endpointsOf(Application application, InstanceName instanceName) {
+ Set<Endpoint> endpoints = new LinkedHashSet<>();
+ Instance instance = application.require(instanceName);
+ DeploymentSpec deploymentSpec = application.deploymentSpec();
+ Optional<DeploymentInstanceSpec> spec = deploymentSpec.instance(instanceName);
+ if (spec.isEmpty()) return EndpointList.EMPTY;
+ // Add endpoint declared with legacy syntax
+ spec.get().globalServiceId().ifPresent(clusterId -> {
+ List<DeploymentId> deployments = spec.get().zones().stream()
+ .filter(zone -> zone.concerns(Environment.prod))
+ .map(zone -> new DeploymentId(instance.id(), ZoneId.from(Environment.prod, zone.region().get())))
+ .collect(Collectors.toList());
+ RoutingId routingId = RoutingId.of(instance.id(), EndpointId.defaultId());
+ endpoints.addAll(computeGlobalEndpoints(routingId, ClusterSpec.Id.from(clusterId), deployments, deploymentSpec));
+ });
+ // Add endpoints declared with current syntax
+ spec.get().endpoints().forEach(declaredEndpoint -> {
+ RoutingId routingId = RoutingId.of(instance.id(), EndpointId.of(declaredEndpoint.endpointId()));
+ List<DeploymentId> deployments = declaredEndpoint.regions().stream()
+ .map(region -> new DeploymentId(instance.id(),
+ ZoneId.from(Environment.prod, region)))
+ .collect(Collectors.toList());
+ endpoints.addAll(computeGlobalEndpoints(routingId, ClusterSpec.Id.from(declaredEndpoint.containerId()), deployments, deploymentSpec));
+ });
+ return EndpointList.copyOf(endpoints);
}
- /** Returns endpoints declared in {@link DeploymentSpec} for given application */
- public EndpointList declaredEndpointsOf(Application application) {
+ /** Returns application-scoped endpoints for given application */
+ public EndpointList endpointsOf(TenantAndApplicationId applicationId) {
+ Application app = controller.applications().requireApplication(applicationId);
Set<Endpoint> endpoints = new LinkedHashSet<>();
- for (var instance : application.instances().values()) {
- DeploymentSpec deploymentSpec = application.deploymentSpec();
- Optional<DeploymentInstanceSpec> spec = application.deploymentSpec().instance(instance.name());
- if (spec.isEmpty()) return EndpointList.EMPTY;
- // Add endpoint declared with legacy syntax
- spec.get().globalServiceId().ifPresent(clusterId -> {
- List<DeploymentId> deployments = spec.get().zones().stream()
- .filter(zone -> zone.concerns(Environment.prod))
- .map(zone -> new DeploymentId(instance.id(), ZoneId.from(Environment.prod, zone.region().get())))
- .collect(Collectors.toList());
- RoutingId routingId = RoutingId.of(instance.id(), EndpointId.defaultId());
- endpoints.addAll(computeGlobalEndpoints(routingId, ClusterSpec.Id.from(clusterId), deployments, deploymentSpec));
- });
- // Add endpoints declared with current syntax
- spec.get().endpoints().forEach(declaredEndpoint -> {
- RoutingId routingId = RoutingId.of(instance.id(), EndpointId.of(declaredEndpoint.endpointId()));
- List<DeploymentId> deployments = declaredEndpoint.regions().stream()
- .map(region -> new DeploymentId(instance.id(),
- ZoneId.from(Environment.prod, region)))
- .collect(Collectors.toList());
- endpoints.addAll(computeGlobalEndpoints(routingId, ClusterSpec.Id.from(declaredEndpoint.containerId()), deployments, deploymentSpec));
- });
- }
- // Add application endpoints
- for (var declaredEndpoint : application.deploymentSpec().endpoints()) {
+ for (var declaredEndpoint : app.deploymentSpec().endpoints()) {
Map<DeploymentId, Integer> deployments = declaredEndpoint.targets().stream()
- .collect(Collectors.toMap(t -> new DeploymentId(application.id().instance(t.instance()),
+ .collect(Collectors.toMap(t -> new DeploymentId(applicationId.instance(t.instance()),
ZoneId.from(Environment.prod, t.region())),
t -> t.weight()));
- List<RoutingMethod> availableRoutingMethods = routingMethodsOfAll(deployments.keySet(), application.deploymentSpec());
+ List<RoutingMethod> availableRoutingMethods = routingMethodsOfAll(deployments.keySet(), app.deploymentSpec());
for (var routingMethod : availableRoutingMethods) {
- endpoints.add(Endpoint.of(application.id())
+ endpoints.add(Endpoint.of(applicationId)
.targetApplication(EndpointId.of(declaredEndpoint.endpointId()),
ClusterSpec.Id.from(declaredEndpoint.containerId()),
deployments)
@@ -161,11 +162,11 @@ public class RoutingController {
return EndpointList.copyOf(endpoints);
}
- /** Read and return zone-scoped endpoints for given deployments, grouped by their zone */
- public Map<ZoneId, List<Endpoint>> readZoneEndpointsOf(Collection<DeploymentId> deployments) {
+ /** Returns all zone-scoped endpoints and corresponding cluster IDs for given deployments, grouped by their zone */
+ public Map<ZoneId, List<Endpoint>> zoneEndpointsOf(Collection<DeploymentId> deployments) {
var endpoints = new TreeMap<ZoneId, List<Endpoint>>(Comparator.comparing(ZoneId::value));
for (var deployment : deployments) {
- EndpointList zoneEndpoints = readEndpointsOf(deployment).scope(Endpoint.Scope.zone).not().legacy();
+ EndpointList zoneEndpoints = endpointsOf(deployment).scope(Endpoint.Scope.zone).not().legacy();
zoneEndpoints = directEndpoints(zoneEndpoints, deployment.applicationId());
if ( ! zoneEndpoints.isEmpty()) {
endpoints.put(deployment.zoneId(), zoneEndpoints.asList());
@@ -205,7 +206,7 @@ public class RoutingController {
/** Change status of all global endpoints for given deployment */
public void setGlobalRotationStatus(DeploymentId deployment, EndpointStatus status) {
- readDeclaredEndpointsOf(deployment.applicationId()).requiresRotation().primary().ifPresent(endpoint -> {
+ endpointsOf(deployment.applicationId()).requiresRotation().primary().ifPresent(endpoint -> {
try {
controller.serviceRegistry().configServer().setGlobalRotationStatus(deployment, endpoint.upstreamIdOf(deployment), status);
} catch (Exception e) {
@@ -217,7 +218,7 @@ public class RoutingController {
/** Get global endpoint status for given deployment */
public Map<Endpoint, EndpointStatus> globalRotationStatus(DeploymentId deployment) {
var routingEndpoints = new LinkedHashMap<Endpoint, EndpointStatus>();
- readDeclaredEndpointsOf(deployment.applicationId()).requiresRotation().primary().ifPresent(endpoint -> {
+ endpointsOf(deployment.applicationId()).requiresRotation().primary().ifPresent(endpoint -> {
var upstreamName = endpoint.upstreamIdOf(deployment);
var status = controller.serviceRegistry().configServer().getGlobalRotationStatus(deployment, upstreamName);
routingEndpoints.put(endpoint, status);
@@ -240,18 +241,17 @@ public class RoutingController {
return application;
}
- /** Returns the global and application-level endpoints for given deployment, as container endpoints */
+ /** Returns the global endpoints for given deployment as container endpoints */
public Set<ContainerEndpoint> containerEndpointsOf(Application application, InstanceName instanceName, ZoneId zone) {
Instance instance = application.require(instanceName);
- boolean registerLegacyNames = requiresLegacyNames(application.deploymentSpec(), instanceName);
+ boolean registerLegacyNames = legacyNamesAvailable(application.deploymentSpec(), instanceName);
Set<ContainerEndpoint> containerEndpoints = new HashSet<>();
- EndpointList endpoints = declaredEndpointsOf(application);
- EndpointList globalEndpoints = endpoints.scope(Endpoint.Scope.global);
+ EndpointList endpoints = endpointsOf(application, instanceName);
// Add endpoints backed by a rotation, and register them in DNS if necessary
for (var assignedRotation : instance.rotations()) {
var names = new ArrayList<String>();
- EndpointList rotationEndpoints = globalEndpoints.named(assignedRotation.endpointId())
- .requiresRotation();
+ EndpointList rotationEndpoints = endpoints.named(assignedRotation.endpointId())
+ .requiresRotation();
// Skip rotations which do not apply to this zone. Legacy names always point to all zones
if (!registerLegacyNames && !assignedRotation.regions().contains(zone.region())) {
@@ -276,45 +276,17 @@ public class RoutingController {
// Include rotation ID as a valid name of this container endpoint (required by global routing health checks)
names.add(assignedRotation.rotationId().asString());
- containerEndpoints.add(new ContainerEndpoint(assignedRotation.clusterId().value(),
- asString(Endpoint.Scope.global),
- names));
+ containerEndpoints.add(new ContainerEndpoint(assignedRotation.clusterId().value(), names));
}
- // Add endpoints not backed by a rotation (i.e. other routing methods so that the config server always knows
- // about global names, even when not using rotations)
+ // Add endpoints not backed by a rotation
DeploymentId deployment = new DeploymentId(instance.id(), zone);
- globalEndpoints.not().requiresRotation()
- .targets(deployment)
- .groupingBy(Endpoint::cluster)
- .forEach((clusterId, clusterEndpoints) -> {
- containerEndpoints.add(new ContainerEndpoint(clusterId.value(),
- asString(Endpoint.Scope.global),
- clusterEndpoints.mapToList(Endpoint::dnsName)));
- });
- // Add application endpoints
- EndpointList applicationEndpoints = endpoints.scope(Endpoint.Scope.application)
- .not().direct() // These are handled by RoutingPolicies
- .targets(deployment);
- for (var endpoint : applicationEndpoints) {
- Set<ZoneId> targetZones = endpoint.targets().stream()
- .map(t -> t.deployment().zoneId())
- .collect(Collectors.toUnmodifiableSet());
- if (targetZones.size() != 1) throw new IllegalArgumentException("Endpoint '" + endpoint.name() +
- "' must target a single zone, got " +
- targetZones);
- ZoneId targetZone = targetZones.iterator().next();
- String vipHostname = controller.zoneRegistry().getVipHostname(targetZone)
- .orElseThrow(() -> new IllegalArgumentException("No VIP configured for zone " + targetZone));
- controller.nameServiceForwarder().createCname(RecordName.from(endpoint.dnsName()),
- RecordData.fqdn(vipHostname),
- Priority.normal);
- }
- applicationEndpoints.groupingBy(Endpoint::cluster)
- .forEach((clusterId, clusterEndpoints) -> {
- containerEndpoints.add(new ContainerEndpoint(clusterId.value(),
- asString(Endpoint.Scope.application),
- clusterEndpoints.mapToList(Endpoint::dnsName)));
- });
+ endpoints.not().requiresRotation()
+ .targets(deployment)
+ .groupingBy(Endpoint::cluster)
+ .forEach((clusterId, clusterEndpoints) -> {
+ containerEndpoints.add(new ContainerEndpoint(clusterId.value(),
+ clusterEndpoints.mapToList(Endpoint::dnsName)));
+ });
return Collections.unmodifiableSet(containerEndpoints);
}
@@ -380,8 +352,9 @@ public class RoutingController {
private List<Endpoint> computeGlobalEndpoints(RoutingId routingId, ClusterSpec.Id cluster, List<DeploymentId> deployments, DeploymentSpec deploymentSpec) {
var endpoints = new ArrayList<Endpoint>();
var directMethods = 0;
+ var zones = deployments.stream().map(DeploymentId::zoneId).collect(Collectors.toList());
var availableRoutingMethods = routingMethodsOfAll(deployments, deploymentSpec);
- boolean legacyNamesAvailable = requiresLegacyNames(deploymentSpec, routingId.instance().instance());
+ boolean legacyNamesAvailable = legacyNamesAvailable(deploymentSpec, routingId.instance().instance());
for (var method : availableRoutingMethods) {
if (method.isDirect() && ++directMethods > 1) {
@@ -413,7 +386,7 @@ public class RoutingController {
}
/** Whether legacy global DNS names should be available for given application */
- private static boolean requiresLegacyNames(DeploymentSpec deploymentSpec, InstanceName instanceName) {
+ private static boolean legacyNamesAvailable(DeploymentSpec deploymentSpec, InstanceName instanceName) {
return deploymentSpec.instance(instanceName)
.flatMap(DeploymentInstanceSpec::globalServiceId)
.isPresent();
@@ -437,14 +410,5 @@ public class RoutingController {
return endpoints;
}
- private static String asString(Endpoint.Scope scope) {
- switch (scope) {
- case application: return "application";
- case global: return "global";
- case weighted: return "weighted";
- case zone: return "zone";
- }
- throw new IllegalArgumentException("Unknown scope " + scope);
- }
}
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 35601dd94dd..3698c794e8f 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
@@ -36,7 +36,6 @@ public class Endpoint {
private final EndpointId id;
private final ClusterSpec.Id cluster;
- private final Optional<InstanceName> instance;
private final URI url;
private final List<Target> targets;
private final Scope scope;
@@ -60,11 +59,11 @@ public class Endpoint {
if (scope == Scope.zone && id != null) throw new IllegalArgumentException("Endpoint ID cannot be set for " + scope + " endpoints");
if (targets.size() != 1) throw new IllegalArgumentException("A single target must be given for " + scope + " endpoints");
}
- if (scope != Scope.application && instanceName.isEmpty()) {
+ if (scope != Scope.region && instanceName.isEmpty()) {
throw new IllegalArgumentException("Instance must be set for scope " + scope);
}
for (var target : targets) {
- if (scope == Scope.application) {
+ if (scope == Scope.region) {
TenantAndApplicationId owner = TenantAndApplicationId.from(target.deployment().applicationId());
if (!owner.equals(application)) {
throw new IllegalArgumentException(id + " has target owned by " + owner +
@@ -82,7 +81,6 @@ public class Endpoint {
}
this.id = id;
this.cluster = cluster;
- this.instance = instanceName;
this.url = url;
this.targets = List.copyOf(targets);
this.scope = scope;
@@ -126,11 +124,6 @@ public class Endpoint {
return cluster;
}
- /** The specific instance this endpoint points to, if any */
- public Optional<InstanceName> instance() {
- return instance;
- }
-
/** Returns the URL used to access this */
public URI url() {
return url;
@@ -261,14 +254,14 @@ public class Endpoint {
case zone: return "z";
case weighted: return "w";
case global: return "g";
- case application: return "r";
+ case region: return "r";
}
}
switch (scope) {
case zone: return "";
case weighted: return "w";
case global: return "global";
- case application: return "r";
+ case region: return "r";
}
throw new IllegalArgumentException("No scope symbol defined for " + scope + " in " + system);
}
@@ -360,7 +353,7 @@ public class Endpoint {
*
* Traffic is routed across instances according to weights specified in deployment.xml
*/
- application,
+ region,
/** Endpoint points to one or more zones. Traffic is routed to the zone closest to the client */
global,
@@ -377,7 +370,7 @@ public class Endpoint {
/** Returns whether this scope may span multiple deployments */
public boolean multiDeployment() {
- return this == application || this == global;
+ return this == region || this == global;
}
}
@@ -539,7 +532,7 @@ public class Endpoint {
this.targets = deployments.entrySet().stream()
.map(kv -> new Target(kv.getKey(), kv.getValue()))
.collect(Collectors.toUnmodifiableList());
- this.scope = Scope.application;
+ this.scope = Scope.region;
return this;
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/EndpointList.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/EndpointList.java
index f626d832b6a..1ad315545e3 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/EndpointList.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/EndpointList.java
@@ -3,7 +3,6 @@ package com.yahoo.vespa.hosted.controller.application;
import com.yahoo.collections.AbstractFilteringList;
import com.yahoo.config.provision.ClusterSpec;
-import com.yahoo.config.provision.InstanceName;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import java.util.Collection;
@@ -42,12 +41,6 @@ public class EndpointList extends AbstractFilteringList<Endpoint, EndpointList>
return matching(endpoint -> endpoint.cluster().equals(cluster));
}
- /** Returns the subset of endpoints pointing to given instance */
- public EndpointList instance(InstanceName instance) {
- return matching(endpoint -> endpoint.instance().isPresent() &&
- endpoint.instance().get().equals(instance));
- }
-
/** Returns the subset of endpoints which target all of the given deployments */
public EndpointList targets(List<DeploymentId> deployments) {
return matching(endpoint -> endpoint.deployments().containsAll(deployments));
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 577dab69279..ee955fa8ff8 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
@@ -451,7 +451,7 @@ public class InternalStepRunner implements StepRunner {
/** Returns true iff all calls to endpoint in the deployment give 100 consecutive 200 OK responses on /status.html. */
private boolean containersAreUp(ApplicationId id, ZoneId zoneId, DualLogger logger) {
- var endpoints = controller.routing().readZoneEndpointsOf(Set.of(new DeploymentId(id, zoneId)));
+ var endpoints = controller.routing().zoneEndpointsOf(Set.of(new DeploymentId(id, zoneId)));
if ( ! endpoints.containsKey(zoneId))
return false;
@@ -477,7 +477,7 @@ public class InternalStepRunner implements StepRunner {
}
private boolean endpointsAvailable(ApplicationId id, ZoneId zone, DualLogger logger) {
- var endpoints = controller.routing().readZoneEndpointsOf(Set.of(new DeploymentId(id, zone)));
+ var endpoints = controller.routing().zoneEndpointsOf(Set.of(new DeploymentId(id, zone)));
if ( ! endpoints.containsKey(zone)) {
logger.log("Endpoints not yet ready.");
return false;
@@ -586,7 +586,7 @@ public class InternalStepRunner implements StepRunner {
deployments.add(new DeploymentId(id.application(), zoneId));
logger.log("Attempting to find endpoints ...");
- var endpoints = controller.routing().readZoneEndpointsOf(deployments);
+ var endpoints = controller.routing().zoneEndpointsOf(deployments);
if ( ! endpoints.containsKey(zoneId)) {
logger.log(WARNING, "Endpoints for the deployment to test vanished again, while it was still active!");
return Optional.of(error);
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 0ecf259be1c..4144eda212b 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
@@ -1371,7 +1371,7 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
// Add zone endpoints
boolean legacyEndpoints = request.getBooleanProperty("includeLegacyEndpoints");
var endpointArray = response.setArray("endpoints");
- EndpointList zoneEndpoints = controller.routing().readEndpointsOf(deploymentId)
+ EndpointList zoneEndpoints = controller.routing().endpointsOf(deploymentId)
.scope(Endpoint.Scope.zone);
if (!legacyEndpoints) {
zoneEndpoints = zoneEndpoints.not().legacy();
@@ -1379,13 +1379,13 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
for (var endpoint : controller.routing().directEndpoints(zoneEndpoints, deploymentId.applicationId())) {
toSlime(endpoint, endpointArray.addObject());
}
- // Add declared endpoints
- EndpointList declaredEndpoints = controller.routing().declaredEndpointsOf(application)
- .targets(deploymentId);
+ // Add global endpoints
+ EndpointList globalEndpoints = controller.routing().endpointsOf(application, deploymentId.applicationId().instance())
+ .targets(deploymentId);
if (!legacyEndpoints) {
- declaredEndpoints = declaredEndpoints.not().legacy();
+ globalEndpoints = globalEndpoints.not().legacy();
}
- for (var endpoint : controller.routing().directEndpoints(declaredEndpoints, deploymentId.applicationId())) {
+ for (var endpoint : controller.routing().directEndpoints(globalEndpoints, deploymentId.applicationId())) {
toSlime(endpoint, endpointArray.addObject());
}
@@ -2061,7 +2061,7 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
return new SlimeJsonResponse(testConfigSerializer.configSlime(id,
type,
false,
- controller.routing().readZoneEndpointsOf(deployments),
+ controller.routing().zoneEndpointsOf(deployments),
controller.applications().reachableContentClustersByZone(deployments)));
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/routing/RoutingApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/routing/RoutingApiHandler.java
index df4c31f49a1..50fccc19752 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/routing/RoutingApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/routing/RoutingApiHandler.java
@@ -96,7 +96,7 @@ public class RoutingApiHandler extends AuditLoggingRequestHandler {
private HttpResponse endpoints(Path path) {
var instanceId = instanceFrom(path);
- var endpoints = controller.routing().readDeclaredEndpointsOf(instanceId)
+ var endpoints = controller.routing().endpointsOf(instanceId)
.sortedBy(Comparator.comparing(Endpoint::name))
.asList();
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java
index a11ea88a6a8..af3171181a2 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java
@@ -133,7 +133,7 @@ public class RoutingPolicies {
Map<RoutingId, List<RoutingPolicy>> routingTable = instanceRoutingTable(routingPolicies);
for (Map.Entry<RoutingId, List<RoutingPolicy>> routeEntry : routingTable.entrySet()) {
RoutingId routingId = routeEntry.getKey();
- controller.routing().readDeclaredEndpointsOf(routingId.instance())
+ controller.routing().endpointsOf(routingId.instance())
.named(routingId.endpointId())
.not().requiresRotation()
.forEach(endpoint -> updateGlobalDnsOf(endpoint, inactiveZones, routeEntry.getValue()));
@@ -211,8 +211,7 @@ public class RoutingPolicies {
Map<String, Set<AliasTarget>> targetsByEndpoint = new LinkedHashMap<>();
for (Map.Entry<RoutingId, List<RoutingPolicy>> routeEntry : routingTable.entrySet()) {
RoutingId routingId = routeEntry.getKey();
- EndpointList endpoints = controller.routing().readDeclaredEndpointsOf(routingId.application())
- .scope(Endpoint.Scope.application)
+ EndpointList endpoints = controller.routing().endpointsOf(routingId.application())
.named(routingId.endpointId());
if (endpoints.isEmpty()) continue;
if (endpoints.size() > 1) {
@@ -295,7 +294,7 @@ public class RoutingPolicies {
Set<RoutingId> activeRoutingIds = instanceRoutingIds(allocation);
removalCandidates.removeAll(activeRoutingIds);
for (var id : removalCandidates) {
- EndpointList endpoints = controller.routing().readDeclaredEndpointsOf(id.instance())
+ EndpointList endpoints = controller.routing().endpointsOf(id.instance())
.not().requiresRotation()
.named(id.endpointId());
NameServiceForwarder forwarder = nameServiceForwarderIn(allocation.deployment.zoneId());
@@ -316,7 +315,7 @@ public class RoutingPolicies {
for (var id : removalCandidates) {
TenantAndApplicationId application = TenantAndApplicationId.from(id.instance());
EndpointList endpoints = controller.routing()
- .readDeclaredEndpointsOf(application)
+ .endpointsOf(application)
.named(id.endpointId());
List<RoutingPolicy> policies = routingTable.get(id);
for (var policy : policies) {
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 1e8e444896f..e2bc1fa305d 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
@@ -12,7 +12,6 @@ import com.yahoo.config.provision.CloudName;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.HostName;
-import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.TenantName;
import com.yahoo.config.provision.zone.RoutingMethod;
@@ -21,17 +20,16 @@ import com.yahoo.path.Path;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.EndpointStatus;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.certificates.EndpointCertificateMetadata;
-import com.yahoo.vespa.hosted.controller.api.integration.configserver.ContainerEndpoint;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion;
import com.yahoo.vespa.hosted.controller.api.integration.dns.LatencyAliasTarget;
import com.yahoo.vespa.hosted.controller.api.integration.dns.Record;
import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordData;
import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordName;
import com.yahoo.vespa.hosted.controller.api.integration.dns.WeightedAliasTarget;
+import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
import com.yahoo.vespa.hosted.controller.application.Deployment;
import com.yahoo.vespa.hosted.controller.application.DeploymentMetrics;
import com.yahoo.vespa.hosted.controller.application.Endpoint;
-import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentContext;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester;
@@ -46,7 +44,6 @@ import java.time.Duration;
import java.time.Instant;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
@@ -247,7 +244,7 @@ public class ControllerTest {
assertEquals("Rotation names are passed to config server in " + deployment.zone(),
Set.of("rotation-id-01",
"app1--tenant1.global.vespa.oath.cloud"),
- tester.configServer().containerEndpointNames(context.deploymentIdIn(deployment.zone())));
+ tester.configServer().containerEndpoints().get(context.deploymentIdIn(deployment.zone())));
}
context.flushDnsUpdates();
@@ -258,7 +255,7 @@ public class ControllerTest {
assertEquals("app1--tenant1.global.vespa.oath.cloud", record.get().name().asString());
assertEquals("rotation-fqdn-01.", record.get().data().asString());
- List<String> globalDnsNames = tester.controller().routing().readDeclaredEndpointsOf(context.instanceId())
+ List<String> globalDnsNames = tester.controller().routing().endpointsOf(context.instanceId())
.scope(Endpoint.Scope.global)
.mapToList(Endpoint::dnsName);
assertEquals(List.of("app1--tenant1.global.vespa.oath.cloud"), globalDnsNames);
@@ -282,7 +279,7 @@ public class ControllerTest {
"app1--tenant1.global.vespa.oath.cloud",
"app1.tenant1.global.vespa.yahooapis.com",
"app1--tenant1.global.vespa.yahooapis.com"),
- tester.configServer().containerEndpointNames(context.deploymentIdIn(deployment.zone())));
+ tester.configServer().containerEndpoints().get(context.deploymentIdIn(deployment.zone())));
}
context.flushDnsUpdates();
assertEquals(3, tester.controllerTester().nameService().records().size());
@@ -302,7 +299,7 @@ public class ControllerTest {
assertEquals("app1.tenant1.global.vespa.yahooapis.com", record.get().name().asString());
assertEquals("rotation-fqdn-01.", record.get().data().asString());
- List<String> globalDnsNames = tester.controller().routing().readDeclaredEndpointsOf(context.instanceId())
+ List<String> globalDnsNames = tester.controller().routing().endpointsOf(context.instanceId())
.scope(Endpoint.Scope.global)
.mapToList(Endpoint::dnsName);
assertEquals(List.of("app1--tenant1.global.vespa.oath.cloud",
@@ -337,7 +334,7 @@ public class ControllerTest {
for (Deployment deployment : deployments) {
assertEquals("Rotation names are passed to config server in " + deployment.zone(),
ZoneId.from("prod.us-west-1").equals(deployment.zone()) ? west : notWest,
- tester.configServer().containerEndpointNames(context.deploymentIdIn(deployment.zone())));
+ tester.configServer().containerEndpoints().get(context.deploymentIdIn(deployment.zone())));
}
context.flushDnsUpdates();
@@ -384,7 +381,7 @@ public class ControllerTest {
assertEquals(
"Zone " + zone + " is a member of global endpoint",
Set.of("rotation-id-01", "app1--tenant1.global.vespa.oath.cloud"),
- tester.configServer().containerEndpointNames(context.deploymentIdIn(zone))
+ tester.configServer().containerEndpoints().get(context.deploymentIdIn(zone))
);
}
@@ -402,13 +399,13 @@ public class ControllerTest {
assertEquals(
"Zone " + zone + " is a member of global endpoint",
Set.of("rotation-id-01", "app1--tenant1.global.vespa.oath.cloud"),
- tester.configServer().containerEndpointNames(context.deploymentIdIn(zone))
+ tester.configServer().containerEndpoints().get(context.deploymentIdIn(zone))
);
}
assertEquals(
"Zone " + east + " is a member of global endpoint",
Set.of("rotation-id-02", "east--app1--tenant1.global.vespa.oath.cloud"),
- tester.configServer().containerEndpointNames(context.deploymentIdIn(east))
+ tester.configServer().containerEndpoints().get(context.deploymentIdIn(east))
);
// Application is deployed with default endpoint pointing to 3/3 zones
@@ -427,7 +424,7 @@ public class ControllerTest {
? Set.of("rotation-id-01", "app1--tenant1.global.vespa.oath.cloud",
"rotation-id-02", "east--app1--tenant1.global.vespa.oath.cloud")
: Set.of("rotation-id-01", "app1--tenant1.global.vespa.oath.cloud"),
- tester.configServer().containerEndpointNames(context.deploymentIdIn(zone))
+ tester.configServer().containerEndpoints().get(context.deploymentIdIn(zone))
);
}
@@ -595,59 +592,6 @@ public class ControllerTest {
}
@Test
- public void testDnsUpdatesForApplicationEndpoint() {
- var context = tester.newDeploymentContext("tenant1", "app1", "beta");
- ApplicationPackage applicationPackage = new ApplicationPackageBuilder()
- .instances("beta,main")
- .region("us-west-1")
- .region("us-east-3")
- .applicationEndpoint("a", "qrs", "us-west-1",
- Map.of(InstanceName.from("beta"), 2,
- InstanceName.from("main"), 8))
- .applicationEndpoint("b", "qrs", "us-west-1",
- Map.of(InstanceName.from("beta"), 1,
- InstanceName.from("main"), 1))
- .applicationEndpoint("c", "qrs", "us-east-3",
- Map.of(InstanceName.from("beta"), 4,
- InstanceName.from("main"), 6))
- .build();
- context.submit(applicationPackage).deploy();
-
- // Endpoint names are passed to each deployment
- DeploymentId usWest = context.deploymentIdIn(ZoneId.from("prod", "us-west-1"));
- DeploymentId usEast = context.deploymentIdIn(ZoneId.from("prod", "us-east-3"));
- Map<DeploymentId, List<String>> deploymentEndpoints = Map.of(usWest, List.of("a--app1--tenant1.us-west-1-r.vespa.oath.cloud", "b--app1--tenant1.us-west-1-r.vespa.oath.cloud"),
- usEast, List.of("c--app1--tenant1.us-east-3-r.vespa.oath.cloud"));
- deploymentEndpoints.forEach((zone, endpointNames) -> {
- assertEquals("Endpoint names are passed to config server in " + zone,
- Set.of(new ContainerEndpoint("qrs", "application",
- endpointNames)),
- tester.configServer().containerEndpoints().get(zone));
- });
- context.flushDnsUpdates();
-
- // DNS records are created for each endpoint
- Set<Record> records = tester.controllerTester().nameService().records();
- assertEquals(Set.of(new Record(Record.Type.CNAME,
- RecordName.from("a--app1--tenant1.us-west-1-r.vespa.oath.cloud"),
- RecordData.from("vip.prod.us-west-1.")),
- new Record(Record.Type.CNAME,
- RecordName.from("b--app1--tenant1.us-west-1-r.vespa.oath.cloud"),
- RecordData.from("vip.prod.us-west-1.")),
- new Record(Record.Type.CNAME,
- RecordName.from("c--app1--tenant1.us-east-3-r.vespa.oath.cloud"),
- RecordData.from("vip.prod.us-east-3."))),
- records);
- List<String> endpointDnsNames = tester.controller().routing().declaredEndpointsOf(context.application())
- .scope(Endpoint.Scope.application)
- .mapToList(Endpoint::dnsName);
- assertEquals(List.of("a--app1--tenant1.us-west-1-r.vespa.oath.cloud",
- "b--app1--tenant1.us-west-1-r.vespa.oath.cloud",
- "c--app1--tenant1.us-east-3-r.vespa.oath.cloud"),
- endpointDnsNames);
- }
-
- @Test
public void testDevDeployment() {
ApplicationPackage applicationPackage = new ApplicationPackageBuilder().build();
@@ -666,7 +610,7 @@ public class ControllerTest {
assertEquals("DeploymentSpec is not stored", DeploymentSpec.empty, context.application().deploymentSpec());
// Verify zone supports shared layer 4 and shared routing methods
- Set<RoutingMethod> routingMethods = tester.controller().routing().readEndpointsOf(context.deploymentIdIn(zone))
+ Set<RoutingMethod> routingMethods = tester.controller().routing().endpointsOf(context.deploymentIdIn(zone))
.asList()
.stream()
.map(Endpoint::routingMethod)
@@ -912,12 +856,12 @@ public class ControllerTest {
Set.of("application.tenant.global.vespa.oath.cloud",
"foo.application.tenant.global.vespa.oath.cloud",
"us.application.tenant.global.vespa.oath.cloud"),
- tester.configServer().containerEndpointNames(context.deploymentIdIn(zone)));
+ tester.configServer().containerEndpoints().get(context.deploymentIdIn(zone)));
}
assertEquals("Expected container endpoints in " + zone3,
Set.of("application.tenant.global.vespa.oath.cloud",
"foo.application.tenant.global.vespa.oath.cloud"),
- tester.configServer().containerEndpointNames(context.deploymentIdIn(zone3)));
+ tester.configServer().containerEndpoints().get(context.deploymentIdIn(zone3)));
}
@Test
@@ -931,7 +875,7 @@ public class ControllerTest {
tester.controllerTester().zoneRegistry()
.setRoutingMethod(ZoneApiMock.from(zone1), RoutingMethod.shared, RoutingMethod.sharedLayer4)
.setRoutingMethod(ZoneApiMock.from(zone2), RoutingMethod.shared, RoutingMethod.sharedLayer4);
- Supplier<Set<RoutingMethod>> routingMethods = () -> tester.controller().routing().readEndpointsOf(context.deploymentIdIn(zone1))
+ Supplier<Set<RoutingMethod>> routingMethods = () -> tester.controller().routing().endpointsOf(context.deploymentIdIn(zone1))
.asList()
.stream()
.map(Endpoint::routingMethod)
@@ -955,9 +899,9 @@ public class ControllerTest {
assertEquals(Set.of("rotation-id-01",
"application.tenant.global.vespa.oath.cloud",
"application--tenant.global.vespa.oath.cloud"),
- tester.configServer().containerEndpointNames(context.deploymentIdIn(zone)));
+ tester.configServer().containerEndpoints().get(context.deploymentIdIn(zone)));
}
- List<String> zoneDnsNames = tester.controller().routing().readEndpointsOf(context.deploymentIdIn(zone1))
+ List<String> zoneDnsNames = tester.controller().routing().endpointsOf(context.deploymentIdIn(zone1))
.scope(Endpoint.Scope.zone)
.mapToList(Endpoint::dnsName);
assertEquals(List.of("application--tenant.us-west-1.vespa.oath.cloud",
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 a3674fa27bd..37f9b66d5fe 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
@@ -40,8 +40,8 @@ import com.yahoo.vespa.hosted.controller.api.integration.deployment.TestReport;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud;
import com.yahoo.vespa.hosted.controller.api.integration.noderepository.RestartFilter;
import com.yahoo.vespa.hosted.controller.api.integration.secrets.TenantSecretStore;
-import com.yahoo.vespa.hosted.controller.application.SystemApplication;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
+import com.yahoo.vespa.hosted.controller.application.SystemApplication;
import com.yahoo.vespa.serviceview.bindings.ApplicationView;
import com.yahoo.vespa.serviceview.bindings.ClusterView;
import com.yahoo.vespa.serviceview.bindings.ServiceView;
@@ -90,7 +90,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
private final Map<ZoneId, Set<LoadBalancer>> loadBalancers = new HashMap<>();
private final Set<Environment> deferLoadBalancerProvisioning = new HashSet<>();
private final Map<DeploymentId, List<Log>> warnings = new HashMap<>();
- private final Map<DeploymentId, Set<ContainerEndpoint>> containerEndpoints = new HashMap<>();
+ private final Map<DeploymentId, Set<String>> containerEndpoints = new HashMap<>();
private final Map<DeploymentId, List<ClusterMetrics>> clusterMetrics = new HashMap<>();
private final Map<DeploymentId, TestReport> testReport = new HashMap<>();
private List<ProtonMetrics> protonMetrics;
@@ -280,17 +280,10 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
warnings.put(deployment, List.copyOf(logs));
}
- public Map<DeploymentId, Set<ContainerEndpoint>> containerEndpoints() {
+ public Map<DeploymentId, Set<String>> containerEndpoints() {
return Collections.unmodifiableMap(containerEndpoints);
}
- public Set<String> containerEndpointNames(DeploymentId deployment) {
- return containerEndpoints.getOrDefault(deployment, Set.of()).stream()
- .map(ContainerEndpoint::names)
- .flatMap(Collection::stream)
- .collect(Collectors.toUnmodifiableSet());
- }
-
public void setMetrics(DeploymentId deployment, ClusterMetrics clusterMetrics) {
setMetrics(deployment, List.of(clusterMetrics));
}
@@ -393,7 +386,13 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
if (nodeRepository().list(id.zoneId(), NodeFilter.all().applications(id.applicationId())).isEmpty())
provision(id.zoneId(), id.applicationId(), cluster);
- this.containerEndpoints.put(id, deployment.containerEndpoints());
+ this.containerEndpoints.put(
+ id,
+ deployment.containerEndpoints().stream()
+ .map(ContainerEndpoint::names)
+ .flatMap(Collection::stream)
+ .collect(Collectors.toSet())
+ );
if (!deferLoadBalancerProvisioning.contains(id.zoneId().environment())) {
putLoadBalancers(id.zoneId(), List.of(new LoadBalancer(UUID.randomUUID().toString(),
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java
index 23ab91aaf8c..2ef98ec6d2a 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java
@@ -230,14 +230,6 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry
}
@Override
- public Optional<String> getVipHostname(ZoneId zoneId) {
- if (routingMethods(zoneId).stream().anyMatch(RoutingMethod::isShared)) {
- return Optional.of("vip." + zoneId.value());
- }
- return Optional.empty();
- }
-
- @Override
public Optional<Duration> getDeploymentTimeToLive(ZoneId zoneId) {
return Optional.ofNullable(deploymentTimeToLive.get(zoneId));
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java
index b767e8a791f..910e5943989 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java
@@ -63,7 +63,7 @@ public class RotationRepositoryTest {
assertEquals(List.of(expected.id()), rotationIds(application.instance().rotations()));
assertEquals(URI.create("https://app1--tenant1.global.vespa.oath.cloud:4443/"),
- tester.controller().routing().readDeclaredEndpointsOf(application.instanceId()).primary().get().url());
+ tester.controller().routing().endpointsOf(application.instanceId()).primary().get().url());
try (RotationLock lock = repository.lock()) {
List<AssignedRotation> rotations = repository.getOrAssignRotations(application.application().deploymentSpec(),
application.instance(),
@@ -158,7 +158,7 @@ public class RotationRepositoryTest {
application2.submit(applicationPackage);
assertEquals(List.of(new RotationId("foo-1")), rotationIds(application2.instance().rotations()));
assertEquals("https://cd--app2--tenant2.global.vespa.oath.cloud:4443/",
- tester.controller().routing().readDeclaredEndpointsOf(application2.instanceId()).primary().get().url().toString());
+ tester.controller().routing().endpointsOf(application2.instanceId()).primary().get().url().toString());
}
@Test
@@ -174,9 +174,9 @@ public class RotationRepositoryTest {
assertEquals(List.of(new RotationId("foo-1")), rotationIds(instance1.instance().rotations()));
assertEquals(List.of(new RotationId("foo-2")), rotationIds(instance2.instance().rotations()));
assertEquals(URI.create("https://instance1--application1--tenant1.global.vespa.oath.cloud:4443/"),
- tester.controller().routing().readDeclaredEndpointsOf(instance1.instanceId()).primary().get().url());
+ tester.controller().routing().endpointsOf(instance1.instanceId()).primary().get().url());
assertEquals(URI.create("https://instance2--application1--tenant1.global.vespa.oath.cloud:4443/"),
- tester.controller().routing().readDeclaredEndpointsOf(instance2.instanceId()).primary().get().url());
+ tester.controller().routing().endpointsOf(instance2.instanceId()).primary().get().url());
}
@Test
@@ -194,9 +194,9 @@ public class RotationRepositoryTest {
assertEquals(List.of(new RotationId("foo-2")), rotationIds(instance2.instance().rotations()));
assertEquals(URI.create("https://instance1--application1--tenant1.global.vespa.oath.cloud:4443/"),
- tester.controller().routing().readDeclaredEndpointsOf(instance1.instanceId()).primary().get().url());
+ tester.controller().routing().endpointsOf(instance1.instanceId()).primary().get().url());
assertEquals(URI.create("https://instance2--application1--tenant1.global.vespa.oath.cloud:4443/"),
- tester.controller().routing().readDeclaredEndpointsOf(instance2.instanceId()).primary().get().url());
+ tester.controller().routing().endpointsOf(instance2.instanceId()).primary().get().url());
}
private void assertSingleRotation(Rotation expected, List<AssignedRotation> assignedRotations, RotationRepository repository) {
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 c777b659461..afcc5e14d82 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
@@ -789,7 +789,7 @@ public class RoutingPoliciesTest {
Map.of(betaZone1, 1));
assertTrue("Endpoint removed",
tester.controllerTester().controller().routing()
- .readDeclaredEndpointsOf(application)
+ .endpointsOf(application)
.named(EndpointId.of("a1")).isEmpty());
}
@@ -916,7 +916,7 @@ public class RoutingPoliciesTest {
int loadBalancerId, Map<DeploymentId, Integer> deploymentWeights) {
Map<String, List<DeploymentId>> deploymentsByDnsName = new HashMap<>();
for (var deployment : deploymentWeights.keySet()) {
- EndpointList applicationEndpoints = tester.controller().routing().readDeclaredEndpointsOf(application)
+ EndpointList applicationEndpoints = tester.controller().routing().endpointsOf(application)
.named(endpointId)
.targets(deployment)
.cluster(cluster);
@@ -944,7 +944,7 @@ public class RoutingPoliciesTest {
Map<String, List<ZoneId>> zonesByRegionEndpoint = new HashMap<>();
for (var zone : zoneWeights.keySet()) {
DeploymentId deployment = new DeploymentId(instance, zone);
- EndpointList regionEndpoints = tester.controller().routing().readEndpointsOf(deployment)
+ EndpointList regionEndpoints = tester.controller().routing().endpointsOf(deployment)
.cluster(cluster)
.scope(Endpoint.Scope.weighted);
Endpoint regionEndpoint = regionEndpoints.first().orElseThrow(() -> new IllegalArgumentException("No region endpoint found for " + cluster + " in " + deployment));
@@ -965,7 +965,7 @@ public class RoutingPoliciesTest {
latencyTargets.add(latencyTarget);
});
List<DeploymentId> deployments = zoneWeights.keySet().stream().map(z -> new DeploymentId(instance, z)).collect(Collectors.toList());
- String globalEndpoint = tester.controller().routing().readDeclaredEndpointsOf(instance)
+ String globalEndpoint = tester.controller().routing().endpointsOf(instance)
.named(endpointId)
.targets(deployments)
.primary()