Search in sources :

Example 31 with Zone

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));
}
Also used : RegionName(com.yahoo.config.provision.RegionName) Zone(com.yahoo.config.provision.Zone) Environment(com.yahoo.config.provision.Environment) SystemName(com.yahoo.config.provision.SystemName)

Example 32 with Zone

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;
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) Zone(com.yahoo.config.provision.Zone) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage)

Example 33 with Zone

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());
}
Also used : ConfigserverConfig(com.yahoo.cloud.config.ConfigserverConfig) DeployState(com.yahoo.config.model.deploy.DeployState) MockRoot(com.yahoo.config.model.test.MockRoot) Zone(com.yahoo.config.provision.Zone) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) Test(org.junit.Test)

Example 34 with Zone

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);
}
Also used : ContentClusterBuilder(com.yahoo.vespa.model.content.utils.ContentClusterBuilder) Zone(com.yahoo.config.provision.Zone) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 35 with Zone

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"));
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) SentinelConfig(com.yahoo.cloud.config.SentinelConfig) Zone(com.yahoo.config.provision.Zone) TestRoot(com.yahoo.config.model.test.TestRoot) TestDriver(com.yahoo.config.model.test.TestDriver) Test(org.junit.Test)

Aggregations

Zone (com.yahoo.config.provision.Zone)71 Test (org.junit.Test)64 ApplicationId (com.yahoo.config.provision.ApplicationId)51 Node (com.yahoo.vespa.hosted.provision.Node)17 Flavor (com.yahoo.config.provision.Flavor)15 ClusterSpec (com.yahoo.config.provision.ClusterSpec)13 HostSpec (com.yahoo.config.provision.HostSpec)12 OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)10 HashSet (java.util.HashSet)8 DeployState (com.yahoo.config.model.deploy.DeployState)6 NestedTransaction (com.yahoo.transaction.NestedTransaction)6 Curator (com.yahoo.vespa.curator.Curator)6 MockCurator (com.yahoo.vespa.curator.mock.MockCurator)6 NodeList (com.yahoo.vespa.hosted.provision.NodeList)6 MockNameResolver (com.yahoo.vespa.hosted.provision.testutils.MockNameResolver)6 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)5 Version (com.yahoo.component.Version)5 RegionName (com.yahoo.config.provision.RegionName)5 TenantName (com.yahoo.config.provision.TenantName)5 FlavorsConfig (com.yahoo.config.provisioning.FlavorsConfig)5