summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <jvenstad@yahoo-inc.com>2019-01-08 13:29:21 +0100
committerJon Marius Venstad <jvenstad@yahoo-inc.com>2019-01-08 13:29:21 +0100
commit269d1724a584b477e26eae4bd1adb30ea16b9da3 (patch)
tree0deca9b061cd55ff9ccf0aaca2b7414717f998a4
parent33bcfb52271adbfe50078c5f6d84a9ff2749c80d (diff)
Allow downgrades when pinned, and make sure deployment is on pinned version
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java2
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java8
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java3
3 files changed, 12 insertions, 1 deletions
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 6723f9de6da..f356069ed49 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
@@ -668,7 +668,7 @@ public class ApplicationController {
private void validateRun(Application application, ZoneId zone, Version platformVersion, ApplicationVersion applicationVersion) {
Deployment deployment = application.deployments().get(zone);
if ( zone.environment().isProduction() && deployment != null
- && ( platformVersion.compareTo(deployment.version()) < 0
+ && ( platformVersion.compareTo(deployment.version()) < 0 && ! application.change().isPinning()
|| applicationVersion.compareTo(deployment.applicationVersion()) < 0))
throw new IllegalArgumentException(String.format("Rejecting deployment of %s to %s, as the requested versions (platform: %s, application: %s)" +
" are older than the currently deployed (platform: %s, application: %s).",
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java
index 3c51640cb01..f36b7c8dedb 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java
@@ -456,9 +456,17 @@ public class DeploymentTrigger {
* is already deployed in its zone, i.e., no parts of the change are upgrades, and the full current
* change for the application downgrades the deployment, which is an acknowledgement that the deployed
* version is broken somehow, such that the job may be locked in failure until a new version is released.
+ *
+ * Additionally, if the application is pinned to a Vespa version, and the given change has a (this) platform,
+ * the deployment for the job must be on the pinned version.
*/
public boolean isComplete(Change change, Application application, JobType jobType) {
Optional<Deployment> existingDeployment = deploymentFor(application, jobType);
+ if ( change.isPinning()
+ && change.platform().isPresent()
+ && ! existingDeployment.map(Deployment::version).equals(change.platform()))
+ return false;
+
return application.deploymentJobs().statusOf(jobType).flatMap(JobStatus::lastSuccess)
.map(job -> change.platform().map(job.platform()::equals).orElse(true)
&& change.application().map(job.application()::equals).orElse(true))
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java
index d0cc6ee5a6f..cb67006dd17 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java
@@ -127,6 +127,9 @@ public class Versions {
private static Version targetPlatform(Application application, Change change, Optional<Deployment> deployment,
Version defaultVersion) {
+ if (change.isPinning() && change.platform().isPresent())
+ return change.platform().get();
+
return max(change.platform(), deployment.map(Deployment::version))
.orElse(application.oldestDeployedPlatform()
.orElse(defaultVersion));