diff options
author | Martin Polden <mpolden@mpolden.no> | 2018-12-18 09:23:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-18 09:23:38 +0100 |
commit | 305d22637387d183be17a0582b1ced76f2b44982 (patch) | |
tree | b846dc10436a32b7c6a7b8aafc9c13614ec4445e | |
parent | d7a213e222dfd29fe14fb148fdaaf3ef22160516 (diff) | |
parent | b1ae4c3e8e2a966d5be5579f442953946ace1dd5 (diff) |
Merge pull request #7948 from vespa-engine/mpolden/remove-corp-special-handling
Remove special handling of corp zones
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java | 4 | ||||
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java | 8 | ||||
-rw-r--r-- | controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java (renamed from controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationTest.java) | 38 |
3 files changed, 3 insertions, 47 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java index e5f34f3721a..5a4086f9abb 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java @@ -16,8 +16,6 @@ public enum JobType { component ("component" , null , null ), systemTest ("system-test" , ZoneId.from("test" , "us-east-1") , ZoneId.from("test" , "cd-us-central-1") ), stagingTest ("staging-test" , ZoneId.from("staging", "us-east-3") , ZoneId.from("staging", "cd-us-central-1") ), - // TODO: Remove after corp zone disappears - productionCorpUsEast1 ("production-corp-us-east-1" , ZoneId.from("prod" , "corp-us-east-1") , null ), productionUsEast3 ("production-us-east-3" , ZoneId.from("prod" , "us-east-3") , null ), productionUsWest1 ("production-us-west-1" , ZoneId.from("prod" , "us-west-1") , null ), productionUsCentral1 ("production-us-central-1" , ZoneId.from("prod" , "us-central-1") , null ), @@ -48,7 +46,7 @@ public enum JobType { /** Returns the zone for this job in the given system, or throws if this job does not have a zone */ public ZoneId zone(SystemName system) { if ( ! zones.containsKey(system)) - throw new AssertionError(this + " does not have any zones in " + system + "."); + throw new IllegalArgumentException(this + " does not have any zones in " + system); return zones.get(system); } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java index 6820c4ba6b6..a22e5259919 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.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.rotation; -import com.yahoo.config.application.api.DeploymentSpec; import com.yahoo.config.provision.Environment; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.ApplicationController; @@ -69,8 +68,6 @@ public class RotationRepository { } long productionZones = application.deploymentSpec().zones().stream() .filter(zone -> zone.deploysTo(Environment.prod)) - // Global rotations don't work for nodes in corp network - .filter(zone -> !isCorp(zone)) .count(); if (productionZones < 2) { throw new IllegalArgumentException("global-service-id is set but less than 2 prod zones are defined"); @@ -104,11 +101,6 @@ public class RotationRepository { return allRotations.get(rotation); } - // TODO: Remove after corp zones disappear - private static boolean isCorp(DeploymentSpec.DeclaredZone zone) { - return zone.region().isPresent() && zone.region().get().value().contains("corp"); - } - /** Returns a immutable map of rotation ID to rotation sorted by rotation ID */ private static Map<RotationId, Rotation> from(RotationsConfig rotationConfig) { return rotationConfig.rotations().entrySet().stream() diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java index 1d5ddaa1ec0..666c7774cf5 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java @@ -4,7 +4,6 @@ package com.yahoo.vespa.hosted.controller.rotation; import com.yahoo.config.provision.SystemName; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.ControllerTester; -import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder; import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester; @@ -24,7 +23,7 @@ import static org.junit.Assert.assertFalse; * @author Oyvind Gronnesby * @author mpolden */ -public class RotationTest { +public class RotationRepositoryTest { @Rule public ExpectedException thrown = ExpectedException.none(); @@ -145,40 +144,6 @@ public class RotationTest { } @Test - public void application_with_only_one_non_corp_region() { - tester.controllerTester().zoneRegistry().setZones(ZoneId.from("prod", "corp-us-east-1"), - ZoneId.from("prod", "us-east-3")); - ApplicationPackage applicationPackage = new ApplicationPackageBuilder() - .globalServiceId("foo") - .region("us-east-3") - .region("corp-us-east-1") - .build(); - Application application = tester.createApplication("app2", "tenant2", 22L, - 2L); - thrown.expect(RuntimeException.class); - thrown.expectMessage("less than 2 prod zones are defined"); - tester.deployCompletely(application, applicationPackage); - } - - @Test - public void application_with_corp_region_and_two_non_corp_region() { - tester.controllerTester().zoneRegistry().setZones(ZoneId.from("prod", "corp-us-east-1"), - ZoneId.from("prod", "us-east-3"), - ZoneId.from("prod", "us-west-1")); - ApplicationPackage applicationPackage = new ApplicationPackageBuilder() - .globalServiceId("foo") - .region("us-east-3") - .region("corp-us-east-1") - .region("us-west-1") - .build(); - Application application = tester.createApplication("app2", "tenant2", 22L, - 2L); - tester.deployCompletely(application, applicationPackage); - assertEquals(new RotationId("foo-1"), tester.applications().require(application.id()) - .rotation().get()); - } - - @Test public void prefixes_system_when_not_main() { ApplicationPackage applicationPackage = new ApplicationPackageBuilder() .globalServiceId("foo") @@ -193,4 +158,5 @@ public class RotationTest { assertEquals("https://cd--app2--tenant2.global.vespa.yahooapis.com:4443/", tester.applications().require(application.id()) .globalDnsName(SystemName.cd).get().secureUrl().toString()); } + } |