diff options
author | Harald Musum <musum@oath.com> | 2018-03-21 10:04:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-21 10:04:15 +0100 |
commit | db9aff7fd0015b37b9cb034c6c798e90f231fa5f (patch) | |
tree | e50b9b9b18d31fde988116e3a0bd912153b67b58 | |
parent | bd3fa2c566468de5be29af544c102d5d4e48e386 (diff) | |
parent | c64d15af3cc717dddb54d0d59df313351a0a83db (diff) |
Merge pull request #5389 from vespa-engine/hmusum/remove-zone-from-DeployProperties
Remove zone from DeployProperties, it's already present in DeployState
9 files changed, 33 insertions, 39 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployProperties.java b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployProperties.java index 3e96b225226..95eca49e5e9 100644 --- a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployProperties.java +++ b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployProperties.java @@ -5,7 +5,6 @@ import com.yahoo.config.model.api.ConfigServerSpec; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.HostName; import com.yahoo.config.provision.Version; -import com.yahoo.config.provision.Zone; import java.util.ArrayList; import java.util.List; @@ -13,8 +12,7 @@ import java.util.List; /** * Collection of properties for a deployment. * - * @author lulf - * @since 5.17 + * @author Ulf Lilleengen */ public class DeployProperties { @@ -24,18 +22,15 @@ public class DeployProperties { private final HostName loadBalancerName; private final boolean hostedVespa; private final Version vespaVersion; - private final Zone zone; private DeployProperties(boolean multitenant, ApplicationId applicationId, List<ConfigServerSpec> configServerSpecs, HostName loadBalancerName, boolean hostedVespa, - Version vespaVersion, - Zone zone) { + Version vespaVersion) { this.loadBalancerName = loadBalancerName; this.vespaVersion = vespaVersion; - this.zone = zone; this.multitenant = multitenant || hostedVespa || Boolean.getBoolean("multitenant"); this.applicationId = applicationId; this.serverSpecs.addAll(configServerSpecs); @@ -68,8 +63,6 @@ public class DeployProperties { return vespaVersion; } - public Zone zone() { return zone; } - public static class Builder { private ApplicationId applicationId = ApplicationId.defaultId(); @@ -78,7 +71,6 @@ public class DeployProperties { private HostName loadBalancerName; private boolean hostedVespa = false; private Version vespaVersion = Version.fromIntValues(1, 0, 0); - private Zone zone = Zone.defaultZone(); public Builder applicationId(ApplicationId applicationId) { this.applicationId = applicationId; @@ -110,13 +102,8 @@ public class DeployProperties { return this; } - public Builder zone(Zone zone) { - this.zone = zone; - return this; - } - public DeployProperties build() { - return new DeployProperties(multitenant, applicationId, configServerSpecs, loadBalancerName, hostedVespa, vespaVersion, zone); + return new DeployProperties(multitenant, applicationId, configServerSpecs, loadBalancerName, hostedVespa, vespaVersion); } } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java b/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java index 91830019573..be76a8dfa40 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java @@ -149,7 +149,7 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Seri this.allocatedHosts = AllocatedHosts.withHosts(root.getHostSystem().getHostSpecs()); // must happen after the two lines above setupRouting(); this.fileDistributor = root.getFileDistributionConfigProducer().getFileDistributor(); - getAdmin().addPerHostServices(getHostSystem().getHosts(), deployState.getProperties()); + getAdmin().addPerHostServices(getHostSystem().getHosts(), deployState); freezeModelTopology(); root.prepare(configModelRepo); configModelRepo.prepareConfigModels(); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java b/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java index 300cd34f57e..71e4e06f716 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java @@ -151,7 +151,6 @@ public class VespaModelFactory implements ModelFactory { .multitenant(properties.multitenant()) .hostedVespa(properties.hostedVespa()) .vespaVersion(getVersion()) - .zone(properties.zone()) .build(); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/Admin.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/Admin.java index 68030cd47da..aa8bbda0151 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/admin/Admin.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/Admin.java @@ -5,7 +5,7 @@ import com.yahoo.cloud.config.SlobroksConfig; import com.yahoo.cloud.config.ZookeepersConfig; import com.yahoo.cloud.config.log.LogdConfig; import com.yahoo.config.model.api.ConfigServerSpec; -import com.yahoo.config.model.deploy.DeployProperties; +import com.yahoo.config.model.deploy.DeployState; import com.yahoo.config.model.producer.AbstractConfigProducer; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Zone; @@ -176,17 +176,17 @@ public class Admin extends AbstractConfigProducer implements Serializable { /** * Adds services to all hosts in the system. */ - public void addPerHostServices(List<HostResource> hosts, DeployProperties properties) { + public void addPerHostServices(List<HostResource> hosts, DeployState deployState) { if (slobroks.isEmpty()) // TODO: Move to caller slobroks.addAll(createDefaultSlobrokSetup()); for (HostResource host : hosts) { if (!host.getHost().runsConfigServer()) { - addCommonServices(host, properties); + addCommonServices(host, deployState); } } } - private void addCommonServices(HostResource host, DeployProperties properties) { - addConfigSentinel(host, properties.applicationId(), properties.zone()); + private void addCommonServices(HostResource host, DeployState deployState) { + addConfigSentinel(host, deployState.getProperties().applicationId(), deployState.zone()); addLogd(host); addConfigProxy(host); addFileDistribution(host); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java index 35975c5fcdc..a8e89af0a42 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java @@ -112,7 +112,7 @@ public class ContentCluster extends AbstractConfigProducer implements StorDistri ContentCluster c = new ContentCluster(context.getParentProducer(), getClusterName(contentElement), documentDefinitions, globallyDistributedDocuments, routingSelection, redundancy, - context.getDeployState().getProperties().zone()); + context.getDeployState().zone()); c.clusterControllerConfig = new ClusterControllerConfig.Builder(getClusterName(contentElement), contentElement).build(c, contentElement.getXml()); c.search = new ContentSearchCluster.Builder(documentDefinitions, globallyDistributedDocuments).build(c, contentElement.getXml()); c.persistenceFactory = new EngineFactoryBuilder().build(contentElement, c); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/admin/AdminTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/admin/AdminTestCase.java index 8cfd532af84..5e6241a7043 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/admin/AdminTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/admin/AdminTestCase.java @@ -144,12 +144,16 @@ public class AdminTestCase { @Test public void testTenantAndAppInSentinelConfig() { - DeployState state = new DeployState.Builder().properties( - new DeployProperties.Builder(). - zone(new Zone(Environment.dev, RegionName.from("baz"))). - applicationId(new ApplicationId.Builder(). - tenant("quux"). - applicationName("foo").instanceName("bim").build()).build()).build(true); + DeployState state = new DeployState.Builder() + .zone(new Zone(Environment.dev, RegionName.from("baz"))) + .properties(new DeployProperties.Builder() + .applicationId(new ApplicationId.Builder() + .tenant("quux") + .applicationName("foo") + .instanceName("bim") + .build()) + .build()) + .build(true); TestRoot root = new TestDriver().buildModel(state); String localhost = HostName.getLocalhost(); SentinelConfig config = root.getConfig(SentinelConfig.class, "hosts/" + localhost); @@ -305,12 +309,15 @@ public class AdminTestCase { @Test public void testDisableFileDistributorForAllApps() { DeployState state = new DeployState.Builder() + .zone(new Zone(Environment.dev, RegionName.from("baz"))) .properties( new DeployProperties.Builder(). - zone(new Zone(Environment.dev, RegionName.from("baz"))). applicationId(new ApplicationId.Builder(). tenant("quux"). - applicationName("foo").instanceName("bim").build()).build()).build(true); + applicationName("foo").instanceName("bim") + .build()) + .build()) + .build(true); TestRoot root = new TestDriver().buildModel(state); String localhost = HostName.getLocalhost(); SentinelConfig sentinelConfig = root.getConfig(SentinelConfig.class, "hosts/" + localhost); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2BuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2BuilderTest.java index 16a01360a51..7402d75dbb0 100755 --- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2BuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2BuilderTest.java @@ -4,7 +4,6 @@ package com.yahoo.vespa.model.builder.xml.dom; import com.yahoo.cloud.config.log.LogdConfig; import com.yahoo.config.model.ConfigModelContext; import com.yahoo.config.model.api.ConfigServerSpec; -import com.yahoo.config.model.deploy.DeployProperties; import com.yahoo.config.model.builder.xml.test.DomBuilderTest; import com.yahoo.config.model.test.MockRoot; import com.yahoo.text.XML; @@ -212,7 +211,7 @@ public class DomAdminV2BuilderTest extends DomBuilderTest { root.getDeployState().getFileRegistry(), multitenant, configServerSpecs); Admin admin = domAdminBuilder.build(root, xml); - admin.addPerHostServices(root.getHostSystem().getHosts(), new DeployProperties.Builder().build()); + admin.addPerHostServices(root.getHostSystem().getHosts(), root.getDeployState()); return admin; } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterTest.java index c3e59ad930d..7ece950b383 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterTest.java @@ -798,10 +798,11 @@ public class ClusterTest extends ContentBaseTest { } private ContentCluster createWithZone(String clusterXml, Zone zone) throws Exception { - DeployState.Builder deployStateBuilder = new DeployState.Builder().properties(new DeployProperties.Builder() - .hostedVespa(true) - .zone(zone) - .build()); + DeployState.Builder deployStateBuilder = new DeployState.Builder() + .zone(zone) + .properties(new DeployProperties.Builder() + .hostedVespa(true) + .build()); List<String> searchDefinitions = SearchDefinitionBuilder.createSearchDefinitions("test"); MockRoot root = ContentClusterUtils.createMockRoot(searchDefinitions, deployStateBuilder); ContentCluster cluster = ContentClusterUtils.createCluster(clusterXml, root); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/model/LbServicesProducerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/model/LbServicesProducerTest.java index 3c6bfb33e56..8b89027e4a1 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/model/LbServicesProducerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/model/LbServicesProducerTest.java @@ -89,7 +89,8 @@ public class LbServicesProducerTest { private LbServicesConfig createModelAndGetLbServicesConfig(RegionName regionName) throws IOException, SAXException { final Zone zone = new Zone(Environment.prod, regionName); Map<TenantName, Map<ApplicationId, ApplicationInfo>> testModel = createTestModel(new DeployState.Builder() - .properties(new DeployProperties.Builder().zone(zone).build()) + .zone(zone) + .properties(new DeployProperties.Builder().build()) .zone(zone)); return getLbServicesConfig(new Zone(Environment.prod, regionName), testModel); } |