diff options
author | Harald Musum <musum@oath.com> | 2018-12-07 09:40:12 +0100 |
---|---|---|
committer | Harald Musum <musum@oath.com> | 2018-12-07 09:40:12 +0100 |
commit | 6945ef99eb21b026c71b22936ada8a268cde4949 (patch) | |
tree | dbeda11ee87d38a76d46057461e23773538502cf | |
parent | 1dde634c20695af0cb5e90e1d97d2339c90e5495 (diff) |
Remove support for creating RoutingEndpoint without hostname
4 files changed, 11 insertions, 23 deletions
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 index fe3a37effdb..b7c4af96a43 100644 --- 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 @@ -10,12 +10,6 @@ public class RoutingEndpoint { private final String endpoint; private final String hostname; - public RoutingEndpoint(String endpoint, boolean isGlobal) { - this.endpoint = endpoint; - this.hostname = null; - this.isGlobal = isGlobal; - } - public RoutingEndpoint(String endpoint, String hostname, boolean isGlobal) { this.endpoint = endpoint; this.hostname = hostname; diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java index 8108a9e086c..5319543bca3 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java @@ -240,21 +240,16 @@ public class ApplicationController { .replaceAll(".vespa.oath.cloud", ""); String hostname = endpoint.getHostname(); - // This check is needed until the old implementations of - // RoutingEndpoints that lacks hostname is gone - if (hostname != null) { - - // Book-keeping - if (endpoint.isGlobal()) { - hostToGlobalEndpoint.put(hostname, endpoint); - } else { - hostToCanonicalEndpoint.put(hostname, canonicalEndpoint); - } + // Book-keeping + if (endpoint.isGlobal()) { + hostToGlobalEndpoint.put(hostname, endpoint); + } else { + hostToCanonicalEndpoint.put(hostname, canonicalEndpoint); + } - // Return as soon as we have a map between a global and a canonical endpoint - if (hostToGlobalEndpoint.containsKey(hostname) && hostToCanonicalEndpoint.containsKey(hostname)) { - return Optional.of(hostToCanonicalEndpoint.get(hostname)); - } + // Return as soon as we have a map between a global and a canonical endpoint + if (hostToGlobalEndpoint.containsKey(hostname) && hostToCanonicalEndpoint.containsKey(hostname)) { + return Optional.of(hostToCanonicalEndpoint.get(hostname)); } } catch (URISyntaxException use) { throw new IOException(use); @@ -264,7 +259,6 @@ public class ApplicationController { return Optional.empty(); } - /** * Creates a new application for an existing tenant. * diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java index 9e8ee16e0c1..e3b5e1a7942 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java @@ -104,6 +104,7 @@ public class InternalDeploymentTester { id.tenant().value(), zone.region().value(), zone.environment().value()), + "host1", false))); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/RoutingGeneratorMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/RoutingGeneratorMock.java index 46e41eea6e1..28b255e9d0a 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/RoutingGeneratorMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/RoutingGeneratorMock.java @@ -1,7 +1,6 @@ // 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.integration; -import com.yahoo.component.AbstractComponent; import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingEndpoint; import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator; import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; @@ -22,7 +21,7 @@ public class RoutingGeneratorMock implements RoutingGenerator { private final Map<DeploymentId, List<RoutingEndpoint>> allEndpoints = new ConcurrentHashMap<>(); private static final List<RoutingEndpoint> defaultEndpoints = - Arrays.asList(new RoutingEndpoint("http://old-endpoint.vespa.yahooapis.com:4080", false), + Arrays.asList(new RoutingEndpoint("http://old-endpoint.vespa.yahooapis.com:4080", "host1", false), new RoutingEndpoint("http://qrs-endpoint.vespa.yahooapis.com:4080", "host1", false), new RoutingEndpoint("http://feeding-endpoint.vespa.yahooapis.com:4080", "host2", false), new RoutingEndpoint("http://global-endpoint.vespa.yahooapis.com:4080", "host1", true), |