summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2020-08-24 11:17:50 +0200
committerMartin Polden <mpolden@mpolden.no>2020-08-24 11:20:37 +0200
commit2c57eefd40ccd8c3b61a70ad8e82a8b26b8935cf (patch)
tree892ed4ac5ef9a7a1a96face92e9a3e98a24219e7 /controller-server
parentd0dc1411dcc1b3aac5504d7101633c4af1995cc4 (diff)
Consider only compile version of last submission
Diffstat (limited to 'controller-server')
-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.java21
2 files changed, 12 insertions, 20 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 2c0189c0730..e32945064fe 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
@@ -20,7 +20,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.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;
@@ -44,7 +43,6 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.Optional;
import java.util.Set;
import java.util.TreeMap;
import java.util.stream.Collectors;
@@ -280,14 +278,7 @@ public class RoutingController {
if (athenzService.isEmpty()) return false;
// Check minimum required compile-version
- var instance = application.require(deploymentId.applicationId().instance());
- var compileVersion = Optional.ofNullable(instance.deployments().get(deploymentId.zoneId()))
- .map(Deployment::applicationVersion)
- // Use compile version of the deployed version
- .flatMap(ApplicationVersion::compileVersion)
- // ... or compile version of the last submitted application package. This is the
- // case for initial deployments.
- .or(() -> application.latestVersion().flatMap(ApplicationVersion::compileVersion));
+ var compileVersion = application.latestVersion().flatMap(ApplicationVersion::compileVersion);
if (compileVersion.isEmpty()) return false;
if (compileVersion.get().isBefore(DIRECT_ROUTING_MIN_VERSION)) return false;
return true;
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 4116c6c7754..0290c72b9eb 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
@@ -873,20 +873,21 @@ public class ControllerTest {
context.submit(applicationPackageBuilder.build()).deploy();
assertEquals(Set.of(RoutingMethod.shared), routingMethods.get());
- // Without satisfying Athenz service requirement
- context.submit(applicationPackageBuilder.compileVersion(RoutingController.DIRECT_ROUTING_MIN_VERSION).build())
- .deploy();
+ // Without satisfying version requirement
+ applicationPackageBuilder = applicationPackageBuilder.athenzIdentity(AthenzDomain.from("domain"), AthenzService.from("service"));
+ context.submit(applicationPackageBuilder.build()).deploy();
assertEquals(Set.of(RoutingMethod.shared), routingMethods.get());
- // Satisfying all requirements
- context.submit(applicationPackageBuilder.compileVersion(RoutingController.DIRECT_ROUTING_MIN_VERSION)
- .athenzIdentity(AthenzDomain.from("domain"), AthenzService.from("service"))
- .build()).deploy();
- assertEquals(Set.of(RoutingMethod.shared, RoutingMethod.sharedLayer4), routingMethods.get());
+ // Package satisfying all requirements is submitted, but not deployed yet
+ applicationPackageBuilder = applicationPackageBuilder.compileVersion(RoutingController.DIRECT_ROUTING_MIN_VERSION);
+ var context2 = context.submit(applicationPackageBuilder.build());
+ assertEquals("Direct routing endpoint is available after submission and before deploy",
+ Set.of(RoutingMethod.shared, RoutingMethod.sharedLayer4), routingMethods.get());
+ context2.deploy();
- // Global endpoint is configured and includes directly routed endpoint name
+ // Global endpoint is added and includes directly routed endpoint name
applicationPackageBuilder = applicationPackageBuilder.endpoint("default", "default");
- context.submit(applicationPackageBuilder.build()).deploy();
+ context2.submit(applicationPackageBuilder.build()).deploy();
for (var zone : List.of(zone1, zone2)) {
assertEquals(Set.of("rotation-id-01",
"application.tenant.global.vespa.oath.cloud",