diff options
author | Martin Polden <mpolden@mpolden.no> | 2019-10-11 12:45:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-11 12:45:31 +0200 |
commit | 54268089601113c0289397ed9fdbb56a96d2ca12 (patch) | |
tree | 2831d4101c4f21a4665e0cf85d6f2d42108e2af2 /controller-server | |
parent | 969a5856750390297009d0c020af8e7de1bc2095 (diff) | |
parent | c7d2cf23ffc677aaf1e38ed21337028636f49062 (diff) |
Merge pull request #10958 from vespa-engine/mpolden/stop-sending-empty-rotations
Stop sending empty rotationNames parameter
Diffstat (limited to 'controller-server')
2 files changed, 14 insertions, 14 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 1dfcafcfa21..0a260bf3ed5 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 @@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.controller; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.yahoo.component.Version; +import com.yahoo.config.application.api.DeploymentInstanceSpec; import com.yahoo.config.application.api.DeploymentSpec; import com.yahoo.config.application.api.ValidationId; import com.yahoo.config.application.api.ValidationOverrides; @@ -506,7 +507,7 @@ public class ApplicationController { DeploymentId deploymentId = new DeploymentId(application, zone); try { ConfigServer.PreparedApplication preparedApplication = - configServer.deploy(deploymentId, deployOptions, Set.of(), endpoints, applicationCertificate, applicationPackage.zippedContent()); + configServer.deploy(deploymentId, deployOptions, endpoints, applicationCertificate, applicationPackage.zippedContent()); return new ActivateResult(new RevisionId(applicationPackage.hash()), preparedApplication.prepareResponse(), applicationPackage.zippedContent().length); } finally { @@ -535,7 +536,9 @@ public class ApplicationController { */ private Set<ContainerEndpoint> registerEndpointsInDns(DeploymentSpec deploymentSpec, Instance instance, ZoneId zone) { var containerEndpoints = new HashSet<ContainerEndpoint>(); - boolean registerLegacyNames = deploymentSpec.instance(instance.name()).flatMap(i -> i.globalServiceId()).isPresent(); + boolean registerLegacyNames = deploymentSpec.instance(instance.name()) + .flatMap(DeploymentInstanceSpec::globalServiceId) + .isPresent(); for (var assignedRotation : instance.rotations()) { var names = new ArrayList<String>(); var endpoints = instance.endpointsIn(controller.system(), assignedRotation.endpointId()) diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java index 6e7a50b5f81..0c2a4ff01c0 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java @@ -8,10 +8,10 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.HostName; import com.yahoo.config.provision.NodeType; import com.yahoo.config.provision.zone.ZoneId; +import com.yahoo.vespa.hosted.controller.api.application.v4.model.ClusterMetrics; import com.yahoo.vespa.hosted.controller.api.application.v4.model.DeployOptions; import com.yahoo.vespa.hosted.controller.api.application.v4.model.EndpointStatus; import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.ConfigChangeActions; -import com.yahoo.vespa.hosted.controller.api.application.v4.model.ClusterMetrics; import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; import com.yahoo.vespa.hosted.controller.api.identifiers.Hostname; import com.yahoo.vespa.hosted.controller.api.identifiers.Identifier; @@ -35,6 +35,7 @@ import org.apache.commons.io.IOUtils; import java.io.InputStream; import java.time.Instant; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -46,7 +47,6 @@ import java.util.Set; import java.util.logging.Level; import java.util.stream.Collectors; import java.util.stream.IntStream; -import java.util.stream.Stream; /** * @author mortent @@ -272,8 +272,9 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer } @Override - public PreparedApplication deploy(DeploymentId deployment, DeployOptions deployOptions, Set<String> rotationNames, - Set<ContainerEndpoint> containerEndpoints, ApplicationCertificate applicationCertificate, byte[] content) { + public PreparedApplication deploy(DeploymentId deployment, DeployOptions deployOptions, + Set<ContainerEndpoint> containerEndpoints, + ApplicationCertificate applicationCertificate, byte[] content) { lastPrepareVersion = deployOptions.vespaVersion.map(Version::fromString).orElse(null); if (prepareException != null) { RuntimeException prepareException = this.prepareException; @@ -285,16 +286,12 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer if (nodeRepository().list(deployment.zoneId(), deployment.applicationId()).isEmpty()) provision(deployment.zoneId(), deployment.applicationId()); - if (!rotationNames.isEmpty() && !containerEndpoints.isEmpty()) { - throw new IllegalArgumentException("Cannot set both rotations and containerEndpoints"); // Same constraint as a real config server - } - this.rotationNames.put( deployment, - Stream.concat( - containerEndpoints.stream().flatMap(e -> e.names().stream()), - rotationNames.stream() - ).collect(Collectors.toSet()) + containerEndpoints.stream() + .map(ContainerEndpoint::names) + .flatMap(Collection::stream) + .collect(Collectors.toSet()) ); return () -> { |