aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2019-06-20 16:56:06 +0200
committerMartin Polden <mpolden@mpolden.no>2019-06-21 13:15:34 +0200
commit401fed1e55ce5ccc6cef75b153efd83ca410c824 (patch)
tree2ff838e7a94481dd333c8f80a448f5e0347a02b0
parent86ddeed7f3d62f9703f100a013f7f4b39957f3b9 (diff)
Always refresh routing policies
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java19
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPoliciesTest.java1
2 files changed, 10 insertions, 10 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 7b03664e0ab..782a76b684e 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
@@ -422,15 +422,16 @@ public class ApplicationController {
ZoneId zone, DeployOptions deployOptions,
Set<String> rotationNames) {
DeploymentId deploymentId = new DeploymentId(application, zone);
- ConfigServer.PreparedApplication preparedApplication =
- configServer.deploy(deploymentId, deployOptions, rotationNames, List.of(), applicationPackage.zippedContent());
-
- // Refresh routing policies on successful deployment. At this point we can safely assume that the config server
- // has allocated load balancers for the deployment.
- routingPolicies.refresh(application, zone);
-
- return new ActivateResult(new RevisionId(applicationPackage.hash()), preparedApplication.prepareResponse(),
- applicationPackage.zippedContent().length);
+ try {
+ ConfigServer.PreparedApplication preparedApplication =
+ configServer.deploy(deploymentId, deployOptions, rotationNames, List.of(), applicationPackage.zippedContent());
+ return new ActivateResult(new RevisionId(applicationPackage.hash()), preparedApplication.prepareResponse(),
+ applicationPackage.zippedContent().length);
+ } finally {
+ // Even if prepare fails, a load balancer may have been provisioned. Always refresh routing policies so that
+ // any DNS updates can be propagated as early as possible.
+ routingPolicies.refresh(application, zone);
+ }
}
/** Makes sure the application has a global rotation, if eligible. */
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPoliciesTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPoliciesTest.java
index 449ca509ee4..f0344cb8d12 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPoliciesTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPoliciesTest.java
@@ -11,7 +11,6 @@ import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.LoadBalancer;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.dns.Record;
import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordName;
import com.yahoo.vespa.hosted.controller.application.ApplicationPackage;