aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2023-01-10 18:35:11 +0100
committerjonmv <venstad@gmail.com>2023-01-10 18:35:11 +0100
commit3331e13fa38d66657c6f5a86650ff2ecadcffe1b (patch)
tree6d40af94a52b5c8ba9ad1b60f8d76c5aeab843ca /controller-server
parent62ebb8ba050912f4f13d97f5ac4cf02e4c4c415f (diff)
Set newest revision as change for any instances it creates
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java8
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java6
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java26
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json11
4 files changed, 33 insertions, 18 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 28673cdc1d2..39d01b16beb 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
@@ -558,8 +558,8 @@ public class ApplicationController {
}
}
- /** Stores the deployment spec and validation overrides from the application package, and runs cleanup. */
- public void storeWithUpdatedConfig(LockedApplication application, ApplicationPackage applicationPackage) {
+ /** Stores the deployment spec and validation overrides from the application package, and runs cleanup. Returns new instances. */
+ public List<InstanceName> storeWithUpdatedConfig(LockedApplication application, ApplicationPackage applicationPackage) {
validatePackage(applicationPackage, application.get());
application = application.with(applicationPackage.deploymentSpec());
@@ -592,6 +592,10 @@ public class ApplicationController {
}
store(application);
+ return declaredInstances.stream()
+ .map(DeploymentInstanceSpec::name)
+ .filter(instance -> ! existingInstances.containsKey(instance))
+ .toList();
}
/** Deploy a system application to given zone */
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java
index f94bd51fe4c..d41f8e6beb5 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java
@@ -6,6 +6,7 @@ import com.yahoo.component.Version;
import com.yahoo.component.VersionCompatibility;
import com.yahoo.concurrent.UncheckedTimeoutException;
import com.yahoo.config.provision.ApplicationId;
+import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.Tags;
import com.yahoo.config.provision.zone.ZoneId;
@@ -29,6 +30,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.deployment.TestReport;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterId;
import com.yahoo.vespa.hosted.controller.application.ApplicationList;
+import com.yahoo.vespa.hosted.controller.application.Change;
import com.yahoo.vespa.hosted.controller.application.Deployment;
import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId;
import com.yahoo.vespa.hosted.controller.application.pkg.ApplicationPackage;
@@ -589,9 +591,11 @@ public class JobController {
validate(id, submission);
- applications.storeWithUpdatedConfig(application, submission.applicationPackage());
+ List<InstanceName> newInstances = applications.storeWithUpdatedConfig(application, submission.applicationPackage());
if (application.get().projectId().isPresent())
applications.deploymentTrigger().triggerNewRevision(id);
+ for (InstanceName instance : newInstances)
+ controller.applications().deploymentTrigger().forceChange(id.instance(instance), Change.of(version.get().id()));
});
return version.get();
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java
index 13540246078..c3ba7cf1009 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java
@@ -1371,52 +1371,52 @@ public class DeploymentTriggerTest {
app1.runJob(productionUsWest1);
tester.triggerJobs();
- assertEquals(2, tester.jobs().active().size());
+ assertEquals(3, tester.jobs().active().size());
app1.runJob(productionUsEast3);
tester.triggerJobs();
- assertEquals(1, tester.jobs().active().size());
+ assertEquals(2, tester.jobs().active().size());
tester.clock().advance(Duration.ofHours(2));
app1.runJob(productionEuWest1);
tester.triggerJobs();
- assertEquals(1, tester.jobs().active().size());
+ assertEquals(2, tester.jobs().active().size());
app2.assertNotRunning(testEuWest1);
app2.runJob(productionEuWest1);
tester.triggerJobs();
- assertEquals(1, tester.jobs().active().size());
+ assertEquals(2, tester.jobs().active().size());
app2.runJob(testEuWest1);
tester.triggerJobs();
- assertEquals(List.of(), tester.jobs().active());
+ assertEquals(1, tester.jobs().active().size());
tester.clock().advance(Duration.ofHours(1));
app1.runJob(productionUsCentral1);
tester.triggerJobs();
- assertEquals(3, tester.jobs().active().size());
+ assertEquals(4, tester.jobs().active().size());
app1.runJob(testUsCentral1);
tester.triggerJobs();
- assertEquals(2, tester.jobs().active().size());
+ assertEquals(3, tester.jobs().active().size());
app1.runJob(productionApNortheast2);
tester.triggerJobs();
- assertEquals(1, tester.jobs().active().size());
+ assertEquals(2, tester.jobs().active().size());
app1.runJob(productionApNortheast1);
tester.triggerJobs();
- assertEquals(List.of(), tester.jobs().active());
+ assertEquals(1, tester.jobs().active().size());
tester.clock().advance(Duration.ofMinutes(30));
tester.triggerJobs();
- assertEquals(List.of(), tester.jobs().active());
+ assertEquals(1, tester.jobs().active().size());
tester.clock().advance(Duration.ofMinutes(30));
app1.runJob(testApNortheast1);
tester.triggerJobs();
- assertEquals(1, tester.jobs().active().size());
+ assertEquals(2, tester.jobs().active().size());
app1.runJob(testApNortheast2);
tester.triggerJobs();
- assertEquals(1, tester.jobs().active().size());
+ assertEquals(2, tester.jobs().active().size());
app1.runJob(testUsEast3);
tester.triggerJobs();
- assertEquals(1, tester.jobs().active().size());
+ assertEquals(2, tester.jobs().active().size());
app1.runJob(productionApSoutheast1);
tester.triggerJobs();
assertEquals(1, tester.jobs().active().size());
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json
index 38e9d8c823e..35dd6fc5398 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json
@@ -547,7 +547,14 @@
],
"declared": true,
"instance": "instance2",
- "deploying": { },
+ "deploying": {
+ "application": {
+ "build": 4,
+ "compileVersion": "6.1.0",
+ "sourceUrl": "repository1/tree/commit1",
+ "commit": "commit1"
+ }
+ },
"latestVersions": {
"platform": {
"platform": "6.1.0",
@@ -569,7 +576,7 @@
"commit": "commit1"
},
"at": 1000,
- "upgrade": true,
+ "upgrade": false,
"available": [
{
"application": {