summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2019-11-05 09:12:53 +0100
committerJon Marius Venstad <venstad@gmail.com>2019-11-05 10:26:07 +0100
commit005b7f93177adab091932cc4923696e9eb61f791 (patch)
tree16b9c6c1513663ffd50891421755e3ef86bea379 /controller-server
parent942801ff2ff7ed9ec5ed50048a82672240c09765 (diff)
Orchestrate only application with non-empty deployment spec
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java6
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java21
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java1
3 files changed, 17 insertions, 11 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 46e9a08a4bd..33d03801efc 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
@@ -3,6 +3,7 @@ package com.yahoo.vespa.hosted.controller.application;
import com.google.common.collect.ImmutableList;
import com.yahoo.component.Version;
+import com.yahoo.config.application.api.DeploymentSpec;
import com.yahoo.config.application.api.DeploymentSpec.UpgradePolicy;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.vespa.hosted.controller.Application;
@@ -203,6 +204,11 @@ public class ApplicationList {
.orElse(defaultMajorVersion)));
}
+ /** Returns the subset of application which have submitted a non-empty deployment spec. */
+ public ApplicationList withDeploymentSpec() {
+ return filteredOn(application -> ! DeploymentSpec.empty.equals(application.deploymentSpec()));
+ }
+
/** Returns the first n application in this (or all, if there are less than n). */
public ApplicationList first(int n) {
if (list.size() < n) return this;
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 f6a4e6cbd08..a1a66570299 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
@@ -307,12 +307,13 @@ public class DeploymentTrigger {
/** Returns the set of all jobs which have changes to propagate from the upstream steps. */
private List<Job> computeReadyJobs() {
return ApplicationList.from(applications().asList())
- .withProjectId()
- .withChanges()
- .idList().stream()
- .map(this::computeReadyJobs)
- .flatMap(Collection::stream)
- .collect(toList());
+ .withProjectId() // Need to keep this, as we have applications with deployment spec that shouldn't be orchestrated.
+ .withChanges()
+ .withDeploymentSpec()
+ .idList().stream()
+ .map(this::computeReadyJobs)
+ .flatMap(Collection::stream)
+ .collect(toList());
}
/**
@@ -321,11 +322,9 @@ public class DeploymentTrigger {
private List<Job> computeReadyJobs(TenantAndApplicationId id) {
List<Job> jobs = new ArrayList<>();
applications().getApplication(id).ifPresent(application -> {
- Collection<Instance> instances = application.deploymentSpec().equals(DeploymentSpec.empty)
- ? application.instances().values()
- : application.deploymentSpec().instances().stream()
- .flatMap(instance -> application.get(instance.name()).stream())
- .collect(Collectors.toUnmodifiableList());
+ Collection<Instance> instances = application.deploymentSpec().instances().stream()
+ .flatMap(instance -> application.get(instance.name()).stream())
+ .collect(Collectors.toUnmodifiableList());
for (Instance instance : instances) {
Change change = application.change();
Optional<Instant> completedAt = max(instance.deploymentJobs().statusOf(systemTest)
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 754065225ae..de5c04af80b 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
@@ -90,6 +90,7 @@ public class DeploymentTriggerTest {
tester.applications().lockApplicationOrThrow(app.application().id(), locked ->
tester.applications().store(locked.withProjectId(OptionalLong.empty())));
app.timeOutConvergence(productionUsWest1);
+ tester.triggerJobs();
assertEquals("Job is not triggered when no projectId is present", 0, tester.jobs().active().size());
}