summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2020-03-13 11:36:01 +0100
committerGitHub <noreply@github.com>2020-03-13 11:36:01 +0100
commitb6013526a78ca1ec9eb2da973b5cb34827c2be70 (patch)
treeef0bd9c439af1ad36269ecdeec4a443e46fba67c
parentca0319dbe15adcc1d1dc92bdcfc7626ebc6d11d8 (diff)
parentf92f4d9cb387b044ef97193b877b7bde1e654851 (diff)
Merge pull request #12474 from vespa-engine/mpolden/remove-routing-generator
Remove RoutingGenerator
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java4
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingEndpoint.java60
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGenerator.java27
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGeneratorMock.java45
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java11
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java25
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java3
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java12
8 files changed, 0 insertions, 187 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java
index 978a00fbccf..ca939023245 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java
@@ -20,7 +20,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.resource.CostReportCons
import com.yahoo.vespa.hosted.controller.api.integration.resource.MeteringClient;
import com.yahoo.vespa.hosted.controller.api.integration.resource.TenantCost;
import com.yahoo.vespa.hosted.controller.api.integration.routing.GlobalRoutingService;
-import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator;
import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry;
import java.time.Clock;
@@ -41,9 +40,6 @@ public interface ServiceRegistry {
GlobalRoutingService globalRoutingService();
- // TODO(mpolden): Remove
- RoutingGenerator routingGenerator();
-
Mailer mailer();
EndpointCertificateProvider endpointCertificateProvider();
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingEndpoint.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingEndpoint.java
deleted file mode 100644
index c0ccd0722f3..00000000000
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingEndpoint.java
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.hosted.controller.api.integration.routing;
-
-import java.util.Objects;
-
-/**
- * @author smorgrav
- */
-// TODO(mpolden): Remove together with RoutingGenerator and its implementations
-public class RoutingEndpoint {
-
- private final boolean isGlobal;
- private final String endpoint;
- private final String hostname;
- private final String upstreamName;
-
- public RoutingEndpoint(String endpoint, String hostname, boolean isGlobal, String upstreamName) {
- this.endpoint = endpoint;
- this.hostname = hostname;
- this.isGlobal = isGlobal;
- this.upstreamName = upstreamName;
- }
-
- /** Whether this is a global endpoint */
- public boolean isGlobal() {
- return isGlobal;
- }
-
- /** URL for this endpoint */
- public String endpoint() {
- return endpoint;
- }
-
- /** First hostname for an upstream behind this endpoint */
- public String hostname() {
- return hostname;
- }
-
- /** The upstream name of this endpoint */
- public String upstreamName() {
- return upstreamName;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- RoutingEndpoint that = (RoutingEndpoint) o;
- return isGlobal == that.isGlobal &&
- endpoint.equals(that.endpoint) &&
- hostname.equals(that.hostname) &&
- upstreamName.equals(that.upstreamName);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(isGlobal, endpoint, hostname, upstreamName);
- }
-
-}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGenerator.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGenerator.java
deleted file mode 100644
index 8150a99979e..00000000000
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGenerator.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.hosted.controller.api.integration.routing;
-
-import com.yahoo.config.provision.ClusterSpec;
-import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
-
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author bratseth
- * @author smorgrav
- */
-// TODO(mpolden): Remove
-public interface RoutingGenerator {
-
- /**
- * @param deploymentId Specifying an application in a zone
- * @return List of endpoints for that deploymentId
- */
- List<RoutingEndpoint> endpoints(DeploymentId deploymentId);
-
- /** Returns the endpoints of each cluster in the given deployment — nothing global. */
- Map<ClusterSpec.Id, URI> clusterEndpoints(DeploymentId deploymentId);
-
-}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGeneratorMock.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGeneratorMock.java
deleted file mode 100644
index e768a090188..00000000000
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGeneratorMock.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.hosted.controller.api.integration.routing;
-
-import com.yahoo.config.provision.ClusterSpec;
-import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
-
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.stream.Collectors;
-
-/**
- * Returns a default set of endpoints on every query if it has no mappings, or those added by the user, otherwise.
- *
- * @author bratseth
- * @author jonmv
- */
-// TODO(mpolden): Remove
-public class RoutingGeneratorMock implements RoutingGenerator {
-
- private final Map<DeploymentId, List<RoutingEndpoint>> routingTable = new ConcurrentHashMap<>();
-
- @Override
- public List<RoutingEndpoint> endpoints(DeploymentId deployment) {
- return routingTable.getOrDefault(deployment, List.of());
- }
-
- @Override
- public Map<ClusterSpec.Id, URI> clusterEndpoints(DeploymentId deployment) {
- return endpoints(deployment).stream()
- .limit(1)
- .collect(Collectors.toMap(__ -> ClusterSpec.Id.from("default"),
- endpoint -> URI.create(endpoint.endpoint())));
- }
-
- public void putEndpoints(DeploymentId deployment, List<RoutingEndpoint> endpoints) {
- routingTable.put(deployment, endpoints);
- }
-
- public void removeEndpoints(DeploymentId deployment) {
- routingTable.remove(deployment);
- }
-
-}
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 c92157eac9f..9efb745ddf6 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
@@ -21,7 +21,6 @@ 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.application.Deployment;
import com.yahoo.vespa.hosted.controller.application.Endpoint;
-import com.yahoo.vespa.hosted.controller.application.Endpoint.Port;
import com.yahoo.vespa.hosted.controller.application.EndpointList;
import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId;
import com.yahoo.vespa.hosted.controller.dns.NameServiceQueue.Priority;
@@ -85,22 +84,12 @@ public class RoutingController {
/** Returns zone-scoped endpoints for given deployment */
public EndpointList endpointsOf(DeploymentId deployment) {
var endpoints = new LinkedHashSet<Endpoint>();
- // TODO(mpolden): Remove this once all applications have deployed once and config server passes correct cluster
- // id for combined cluster type
- controller.serviceRegistry().routingGenerator().clusterEndpoints(deployment)
- .forEach((cluster, url) -> endpoints.add(Endpoint.of(deployment.applicationId())
- .target(cluster, deployment.zoneId())
- .routingMethod(RoutingMethod.shared)
- .on(Port.fromRoutingMethod(RoutingMethod.shared))
- .in(controller.system())));
- boolean hasSharedEndpoint = !endpoints.isEmpty();
// Avoid reading application more than once per call to this
var application = Suppliers.memoize(() -> controller.applications().requireApplication(TenantAndApplicationId.from(deployment.applicationId())));
for (var policy : routingPolicies.get(deployment).values()) {
if (!policy.status().isActive()) continue;
for (var routingMethod : controller.zoneRegistry().routingMethods(policy.id().zone())) {
if (routingMethod.isDirect() && !canRouteDirectlyTo(deployment, application.get())) continue;
- if (hasSharedEndpoint && routingMethod == RoutingMethod.shared) continue;
endpoints.add(policy.endpointIn(controller.system(), routingMethod));
}
}
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 ad8c7d7c328..a0d2630091b 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
@@ -26,7 +26,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationV
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.routing.RoutingEndpoint;
import com.yahoo.vespa.hosted.controller.application.ApplicationPackage;
import com.yahoo.vespa.hosted.controller.application.Deployment;
import com.yahoo.vespa.hosted.controller.application.DeploymentMetrics;
@@ -785,30 +784,6 @@ public class ControllerTest {
}
@Test
- public void testDeployWithRoutingGeneratorEndpoints() {
- var context = tester.newDeploymentContext();
- var applicationPackage = new ApplicationPackageBuilder()
- .upgradePolicy("default")
- .environment(Environment.prod)
- .region("us-west-1")
- .build();
-
- var zones = Set.of(systemTest.zone(tester.controller().system()),
- stagingTest.zone(tester.controller().system()),
- ZoneId.from("prod", "us-west-1"));
- for (var zone : zones) {
- tester.controllerTester().serviceRegistry().routingGeneratorMock()
- .putEndpoints(context.deploymentIdIn(zone),
- List.of(new RoutingEndpoint("http://legacy-endpoint", "hostname",
- false, "upstreamName")));
- }
- // Defer load balancer provisioning in all environments so that routing controller uses routing generator
- context.deferLoadBalancerProvisioningIn(zones.stream().map(ZoneId::environment).collect(Collectors.toSet()))
- .submit(applicationPackage)
- .deploy();
- }
-
- @Test
public void testDeployWithGlobalEndpointsAndMultipleRoutingMethods() {
var context = tester.newDeploymentContext();
var zone1 = ZoneId.from("prod", "us-west-1");
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java
index 21b6e729e41..c9ad121276f 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java
@@ -18,7 +18,6 @@ import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbi
import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.RefeedAction;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.RestartAction;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.ServiceInfo;
-import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerException;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node;
@@ -178,8 +177,6 @@ public class InternalStepRunnerTest {
.deferLoadBalancerProvisioningIn(testZone.environment());
tester.newDeploymentContext(app.instanceId())
.deferLoadBalancerProvisioningIn(stagingZone.environment());
- tester.controllerTester().serviceRegistry().routingGeneratorMock().putEndpoints(new DeploymentId(app.testerId().id(), testZone), List.of());
- tester.controllerTester().serviceRegistry().routingGeneratorMock().putEndpoints(new DeploymentId(app.instanceId(), stagingZone), List.of());
tester.runner().run();
tester.configServer().convergeServices(app.instanceId(), JobType.stagingTest.zone(system()));
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java
index 8863651e1b5..98178f2a19f 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java
@@ -21,8 +21,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.resource.CostReportCons
import com.yahoo.vespa.hosted.controller.api.integration.resource.MockTenantCost;
import com.yahoo.vespa.hosted.controller.api.integration.routing.GlobalRoutingService;
import com.yahoo.vespa.hosted.controller.api.integration.routing.MemoryGlobalRoutingService;
-import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator;
-import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGeneratorMock;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.DummyOwnershipIssues;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.LoggingDeploymentIssues;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMailer;
@@ -42,7 +40,6 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg
private final ConfigServerMock configServerMock;
private final MemoryNameService memoryNameService = new MemoryNameService();
private final MemoryGlobalRoutingService memoryGlobalRoutingService = new MemoryGlobalRoutingService();
- private final RoutingGeneratorMock routingGeneratorMock = new RoutingGeneratorMock();
private final MockMailer mockMailer = new MockMailer();
private final EndpointCertificateMock endpointCertificateMock = new EndpointCertificateMock();
private final MockMeteringClient mockMeteringClient = new MockMeteringClient();
@@ -92,11 +89,6 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg
}
@Override
- public RoutingGenerator routingGenerator() {
- return routingGeneratorMock;
- }
-
- @Override
public MockMailer mailer() {
return mockMailer;
}
@@ -197,10 +189,6 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg
return memoryGlobalRoutingService;
}
- public RoutingGeneratorMock routingGeneratorMock() {
- return routingGeneratorMock;
- }
-
public MockContactRetriever contactRetrieverMock() {
return mockContactRetriever;
}