aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2019-10-21 09:50:01 +0200
committerJon Marius Venstad <venstad@gmail.com>2019-10-21 09:50:01 +0200
commitebde8eff1b5d66cbdf1c74bfd0ec42cff1bd24fa (patch)
tree4a8f77bc8653667355a3555f71612641a6de15fe /controller-server/src/main
parent9661ecfd34d5185c19ef92bbd1053b2e72b81415 (diff)
Remove instance only when no longer referenced, plus some test fixes
Diffstat (limited to 'controller-server/src/main')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java11
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java1
2 files changed, 4 insertions, 8 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 dd8725da081..0eca30ddeec 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
@@ -485,12 +485,6 @@ public class ApplicationController {
return application;
}
- private boolean specIncludes(DeploymentSpec deploymentSpec, InstanceName name, ZoneId zone) {
- return deploymentSpec.instance(name)
- .map(spec -> spec.includes(zone.environment(), Optional.of(zone.region())))
- .orElse(false);
- }
-
/** Deploy a system application to given zone */
public void deploy(SystemApplication application, ZoneId zone, Version version) {
if (application.hasApplicationPackage()) {
@@ -667,8 +661,9 @@ public class ApplicationController {
(deploymentsToRemove.size() > 1 ? "these zones" : "this zone") +
" in deployment.xml. " +
ValidationOverrides.toAllowMessage(ValidationId.deploymentRemoval));
- // Remove the instance as well, if it contains only production deployments that are removed now.
- boolean removeInstance = application.get().require(instance).deployments().size() == deploymentsToRemove.size();
+ // Remove the instance as well, if it is no longer referenced, and contains only production deployments that are removed now.
+ boolean removeInstance = ! deploymentSpec.instanceNames().contains(instance)
+ && application.get().require(instance).deployments().size() == deploymentsToRemove.size();
for (ZoneId zone : deploymentsToRemove)
application = deactivate(application, instance, zone);
if (removeInstance)
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 701acd3ddd2..45aee670363 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
@@ -6,6 +6,7 @@ import com.yahoo.config.application.api.Endpoint;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.Environment;
+import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.RegionName;
import com.yahoo.vespa.hosted.controller.ApplicationController;
import com.yahoo.vespa.hosted.controller.Instance;