use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class ConfigserverCluster method setContainerCluster.
public void setContainerCluster(ContainerCluster containerCluster) {
this.containerCluster = containerCluster;
// If we are in a config server cluster the correct zone is propagated through cloud config options,
// not through config to deployment options (see StandaloneContainerApplication.scala),
// so we need to propagate the zone options into the container from here
Environment environment = options.environment().isPresent() ? Environment.from(options.environment().get()) : Environment.defaultEnvironment();
RegionName region = options.region().isPresent() ? RegionName.from(options.region().get()) : RegionName.defaultName();
SystemName system = options.system().isPresent() ? SystemName.from(options.system().get()) : SystemName.defaultSystem();
containerCluster.setZone(new Zone(system, environment, region));
}
use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class AccessControlValidatorTest method deployState.
private static DeployState deployState(String servicesXml) {
ApplicationPackage app = new MockApplicationPackage.Builder().withServices(servicesXml).build();
DeployState.Builder builder = new DeployState.Builder().applicationPackage(app).zone(// TODO: remove cd setting
new Zone(SystemName.cd, Environment.prod, RegionName.from("foo"))).properties(new DeployProperties.Builder().hostedVespa(true).build());
final DeployState deployState = builder.build(true);
assertTrue("Test must emulate a hosted deployment.", deployState.isHosted());
assertEquals("Test must emulate a prod environment.", prod, deployState.zone().environment());
return deployState;
}
use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class ContainerClusterTest method requreThatWeCanGetTheZoneConfig.
@Test
public void requreThatWeCanGetTheZoneConfig() {
DeployState state = new DeployState.Builder().properties(new DeployProperties.Builder().hostedVespa(true).build()).zone(new Zone(SystemName.cd, Environment.test, RegionName.from("some-region"))).build(true);
MockRoot root = new MockRoot("foo", state);
ContainerCluster cluster = new ContainerCluster(root, "container0", "container1");
ConfigserverConfig.Builder builder = new ConfigserverConfig.Builder();
cluster.getConfig(builder);
ConfigserverConfig config = new ConfigserverConfig(builder);
assertEquals(Environment.test.value(), config.environment());
assertEquals("some-region", config.region());
assertEquals("cd", config.system());
}
use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class ClusterTest method testZoneDependentDistributionBits.
@Test
public void testZoneDependentDistributionBits() throws Exception {
String xml = new ContentClusterBuilder().docTypes("test").getXml();
ContentCluster prodWith16Bits = createWithZone(xml, new Zone(Environment.prod, RegionName.from("us-east-3")));
assertDistributionBitsInConfig(prodWith16Bits, 16);
ContentCluster stagingNot16Bits = createWithZone(xml, new Zone(Environment.staging, RegionName.from("us-east-3")));
assertDistributionBitsInConfig(stagingNot16Bits, 8);
}
use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class AdminTestCase method testDisableFileDistributorForAllApps.
@Test
public void testDisableFileDistributorForAllApps() {
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 sentinelConfig = root.getConfig(SentinelConfig.class, "hosts/" + localhost);
assertThat(sentinelConfig.service().size(), is(3));
assertThat(sentinelConfig.service(0).name(), is("logserver"));
assertThat(sentinelConfig.service(1).name(), is("slobrok"));
assertThat(sentinelConfig.service(2).name(), is("logd"));
}
Aggregations