diff options
author | Martin Polden <mpolden@mpolden.no> | 2017-09-21 15:41:53 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2017-09-21 15:45:47 +0200 |
commit | 3053bb24f0b16aeb36be83d641693a84bcd452d7 (patch) | |
tree | 33f43efccd69174439e8dcd4c90ad6640ba111a2 /controller-server/src | |
parent | 2c6152bd380bc41c566bbeabcdc11c5376042be4 (diff) |
Remove corp-prod special casing
Diffstat (limited to 'controller-server/src')
3 files changed, 2 insertions, 57 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java index fa7a48c85c2..5af4523b579 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java @@ -5,15 +5,12 @@ import com.google.common.collect.ImmutableList; import com.yahoo.component.Version; import com.yahoo.config.application.api.DeploymentSpec.UpgradePolicy; import com.yahoo.config.provision.ApplicationId; -import com.yahoo.config.provision.Environment; -import com.yahoo.config.provision.RegionName; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.ApplicationController; import java.time.Instant; import java.util.Comparator; import java.util.List; -import java.util.Optional; import java.util.stream.Stream; /** @@ -130,12 +127,7 @@ public class ApplicationList { return listOf(list.stream().filter(a -> !hasRunningJob(a, change))); } - /** Returns the subset of applications which deploys to given environment and region */ - public ApplicationList deploysTo(Environment environment, RegionName region) { - return listOf(list.stream().filter(a -> a.deploymentSpec().includes(environment, Optional.of(region)))); - } - - // ----------------------------------- Internal helpers + // ----------------------------------- Internal helpers private static boolean isUpgradingTo(Version version, Application application) { if ( ! (application.deploying().isPresent()) ) return false; diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/Upgrader.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/Upgrader.java index 22d0a56c367..a4d50d0c150 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/Upgrader.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/Upgrader.java @@ -2,10 +2,7 @@ package com.yahoo.vespa.hosted.controller.maintenance; import com.yahoo.component.Version; -import com.yahoo.component.Vtag; import com.yahoo.config.application.api.DeploymentSpec.UpgradePolicy; -import com.yahoo.config.provision.Environment; -import com.yahoo.config.provision.RegionName; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.application.ApplicationList; @@ -14,7 +11,6 @@ import com.yahoo.vespa.hosted.controller.versions.VespaVersion; import com.yahoo.yolean.Exceptions; import java.time.Duration; -import java.util.Optional; import java.util.logging.Level; import java.util.logging.Logger; @@ -38,19 +34,13 @@ public class Upgrader extends Maintainer { public void maintain() { VespaVersion target = controller().versionStatus().version(controller().systemVersion()); if (target == null) return; // we don't have information about the current system version at this time - - // TODO: Remove corp-prod special casing when corp-prod and main are upgraded at the same time - if (Vtag.currentVersion.isAfter(target.versionNumber())) { - upgrade(applications().deploysTo(Environment.prod, RegionName.from("corp-us-east-1")).with(UpgradePolicy.canary), - Vtag.currentVersion); - } switch (target.confidence()) { case broken: ApplicationList toCancel = applications().upgradingTo(target.versionNumber()) .without(UpgradePolicy.canary); if (toCancel.isEmpty()) break; - log.info("Version " + target.versionNumber() + " is broken, cancelling all upgrades"); + log.info("Version " + target.versionNumber() + " is broken, cancelling upgrades of non-canaries"); cancelUpgradesOf(toCancel); break; case low: diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java index f7af3ba7a3f..3046a89efe6 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java @@ -2,11 +2,9 @@ package com.yahoo.vespa.hosted.controller.maintenance; import com.yahoo.component.Version; -import com.yahoo.component.Vtag; import com.yahoo.config.provision.Environment; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; -import com.yahoo.vespa.hosted.controller.application.Change; import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder; import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester; @@ -362,39 +360,4 @@ public class UpgraderTest { assertEquals(VespaVersion.Confidence.normal, tester.controller().versionStatus().systemVersion().get().confidence()); } - // TODO: Remove when corp-prod special casing is no longer needed - @Test - public void upgradesCanariesToControllerVersion() { - DeploymentTester tester = new DeploymentTester(); - ApplicationPackage applicationPackage = new ApplicationPackageBuilder() - .upgradePolicy("canary") - .environment(Environment.prod) - .region("corp-us-east-1") - .build(); - - Version version = Version.fromString("5.0"); // Lower version than controller (6.10) - tester.updateVersionStatus(version); - - // Application is on 5.0 - Application app = tester.createApplication("app1", "tenant1", 1, 11L); - tester.notifyJobCompletion(DeploymentJobs.JobType.component, app, true); - tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.systemTest); - tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest); - tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.productionCorpUsEast1); - - // Canary in prod.corp-us-east-1 is upgraded to controller version - tester.upgrader().maintain(); - assertEquals("Upgrade started", 1, tester.buildSystem().jobs().size()); - assertEquals(Vtag.currentVersion, ((Change.VersionChange) tester.application(app.id()).deploying().get()).version()); - tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.systemTest); - tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest); - tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.productionCorpUsEast1); - - // System is upgraded to newer version, no upgrade triggered for canary as version is lower than controller - version = Version.fromString("5.1"); - tester.updateVersionStatus(version); - tester.upgrader().maintain(); - assertTrue("No more jobs triggered", tester.buildSystem().jobs().isEmpty()); - } - } |