Search in sources :

Example 76 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class MultigroupProvisioningTest method test_provisioning_of_multiple_groups_after_flavor_migration_and_exiration.

@Test
public void test_provisioning_of_multiple_groups_after_flavor_migration_and_exiration() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
    ApplicationId application1 = tester.makeApplicationId();
    tester.makeReadyNodes(10, "small");
    tester.makeReadyNodes(10, "large");
    deploy(application1, 8, 1, "small", tester);
    deploy(application1, 8, 1, "large", tester);
    // Expire small nodes
    tester.advanceTime(Duration.ofDays(7));
    MockDeployer deployer = new MockDeployer(tester.provisioner(), Collections.singletonMap(application1, new MockDeployer.ApplicationContext(application1, cluster(), Capacity.fromNodeCount(8, Optional.of("large"), false), 1)));
    new RetiredExpirer(tester.nodeRepository(), tester.orchestrator(), deployer, tester.clock(), Duration.ofDays(30), Duration.ofHours(12), new JobControl(tester.nodeRepository().database())).run();
    assertEquals(8, tester.getNodes(application1, Node.State.inactive).flavor("small").size());
    deploy(application1, 8, 8, "large", tester);
}
Also used : Zone(com.yahoo.config.provision.Zone) JobControl(com.yahoo.vespa.hosted.provision.maintenance.JobControl) RetiredExpirer(com.yahoo.vespa.hosted.provision.maintenance.RetiredExpirer) ApplicationId(com.yahoo.config.provision.ApplicationId) MockDeployer(com.yahoo.vespa.hosted.provision.testutils.MockDeployer) Test(org.junit.Test)

Example 77 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class MultigroupProvisioningTest method test_one_node_and_group_to_two_with_flavor_migration.

@Test
public void test_one_node_and_group_to_two_with_flavor_migration() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.perf, RegionName.from("us-east")));
    ApplicationId application1 = tester.makeApplicationId();
    tester.makeReadyNodes(10, "small");
    tester.makeReadyNodes(10, "large");
    deploy(application1, Capacity.fromNodeCount(1, Optional.of("small"), true), 1, tester);
    deploy(application1, Capacity.fromNodeCount(2, Optional.of("large"), true), 2, tester);
}
Also used : Zone(com.yahoo.config.provision.Zone) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 78 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class MockNodeRepository method populate.

private void populate() {
    NodeRepositoryProvisioner provisioner = new NodeRepositoryProvisioner(this, flavors, Zone.defaultZone());
    List<Node> nodes = new ArrayList<>();
    final List<String> ipAddressesForAllHost = Arrays.asList("127.0.0.1", "::1");
    Collections.sort(ipAddressesForAllHost);
    final HashSet<String> ipAddresses = new HashSet<>(ipAddressesForAllHost);
    final List<String> additionalIpAddressesForAllHost = Arrays.asList("::2", "::3", "::4");
    Collections.sort(additionalIpAddressesForAllHost);
    final HashSet<String> additionalIpAddresses = new HashSet<>(additionalIpAddressesForAllHost);
    nodes.add(createNode("node1", "host1.yahoo.com", ipAddresses, Optional.empty(), flavors.getFlavorOrThrow("default"), NodeType.tenant));
    nodes.add(createNode("node2", "host2.yahoo.com", ipAddresses, Optional.empty(), flavors.getFlavorOrThrow("default"), NodeType.tenant));
    nodes.add(createNode("node3", "host3.yahoo.com", ipAddresses, Optional.empty(), flavors.getFlavorOrThrow("expensive"), NodeType.tenant));
    Node node4 = createNode("node4", "host4.yahoo.com", ipAddresses, Optional.of("dockerhost1.yahoo.com"), flavors.getFlavorOrThrow("docker"), NodeType.tenant);
    node4 = node4.with(node4.status().withVespaVersion(new Version("6.41.0")));
    nodes.add(node4);
    Node node5 = createNode("node5", "host5.yahoo.com", ipAddresses, Optional.of("dockerhost2.yahoo.com"), flavors.getFlavorOrThrow("docker"), NodeType.tenant);
    nodes.add(node5.with(node5.status().withVespaVersion(new Version("1.2.3"))));
    nodes.add(createNode("node6", "host6.yahoo.com", ipAddresses, Optional.empty(), flavors.getFlavorOrThrow("default"), NodeType.tenant));
    nodes.add(createNode("node7", "host7.yahoo.com", ipAddresses, Optional.empty(), flavors.getFlavorOrThrow("default"), NodeType.tenant));
    // 8 and 9 are added by web service calls
    Node node10 = createNode("node10", "host10.yahoo.com", ipAddresses, Optional.of("parent1.yahoo.com"), flavors.getFlavorOrThrow("default"), NodeType.tenant);
    Status node10newStatus = node10.status();
    node10newStatus = node10newStatus.withVespaVersion(Version.fromString("5.104.142"));
    node10 = node10.with(node10newStatus);
    nodes.add(node10);
    Node node55 = createNode("node55", "host55.yahoo.com", ipAddresses, Optional.empty(), flavors.getFlavorOrThrow("default"), NodeType.tenant);
    nodes.add(node55.with(node55.status().withWantToRetire(true).withWantToDeprovision(true)));
    /* Setup docker hosts (two of these will be reserved for spares */
    nodes.add(createNode("dockerhost1", "dockerhost1.yahoo.com", ipAddresses, additionalIpAddresses, Optional.empty(), flavors.getFlavorOrThrow("large"), NodeType.host));
    nodes.add(createNode("dockerhost2", "dockerhost2.yahoo.com", ipAddresses, additionalIpAddresses, Optional.empty(), flavors.getFlavorOrThrow("large"), NodeType.host));
    nodes.add(createNode("dockerhost3", "dockerhost3.yahoo.com", ipAddresses, additionalIpAddresses, Optional.empty(), flavors.getFlavorOrThrow("large"), NodeType.host));
    nodes.add(createNode("dockerhost4", "dockerhost4.yahoo.com", ipAddresses, additionalIpAddresses, Optional.empty(), flavors.getFlavorOrThrow("large"), NodeType.host));
    nodes.add(createNode("dockerhost5", "dockerhost5.yahoo.com", ipAddresses, additionalIpAddresses, Optional.empty(), flavors.getFlavorOrThrow("large"), NodeType.host));
    nodes = addNodes(nodes);
    nodes.remove(6);
    nodes.remove(7);
    nodes = setDirty(nodes, Agent.system, getClass().getSimpleName());
    setReady(nodes, Agent.system, getClass().getSimpleName());
    fail("host5.yahoo.com", Agent.system, getClass().getSimpleName());
    setDirty("host55.yahoo.com", Agent.system, getClass().getSimpleName());
    ApplicationId zoneApp = ApplicationId.from(TenantName.from("zoneapp"), ApplicationName.from("zoneapp"), InstanceName.from("zoneapp"));
    ClusterSpec zoneCluster = ClusterSpec.request(ClusterSpec.Type.container, ClusterSpec.Id.from("node-admin"), Version.fromString("6.42"), false);
    activate(provisioner.prepare(zoneApp, zoneCluster, Capacity.fromRequiredNodeType(NodeType.host), 1, null), zoneApp, provisioner);
    ApplicationId app1 = ApplicationId.from(TenantName.from("tenant1"), ApplicationName.from("application1"), InstanceName.from("instance1"));
    ClusterSpec cluster1 = ClusterSpec.request(ClusterSpec.Type.container, ClusterSpec.Id.from("id1"), Version.fromString("6.42"), false);
    provisioner.prepare(app1, cluster1, Capacity.fromNodeCount(2), 1, null);
    ApplicationId app2 = ApplicationId.from(TenantName.from("tenant2"), ApplicationName.from("application2"), InstanceName.from("instance2"));
    ClusterSpec cluster2 = ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("id2"), Version.fromString("6.42"), false);
    activate(provisioner.prepare(app2, cluster2, Capacity.fromNodeCount(2), 1, null), app2, provisioner);
    ApplicationId app3 = ApplicationId.from(TenantName.from("tenant3"), ApplicationName.from("application3"), InstanceName.from("instance3"));
    ClusterSpec cluster3 = ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("id3"), Version.fromString("6.42"), false);
    activate(provisioner.prepare(app3, cluster3, Capacity.fromNodeCount(2, Optional.of("docker"), false), 1, null), app3, provisioner);
}
Also used : Status(com.yahoo.vespa.hosted.provision.node.Status) Version(com.yahoo.component.Version) Node(com.yahoo.vespa.hosted.provision.Node) NodeRepositoryProvisioner(com.yahoo.vespa.hosted.provision.provisioning.NodeRepositoryProvisioner) ArrayList(java.util.ArrayList) ClusterSpec(com.yahoo.config.provision.ClusterSpec) ApplicationId(com.yahoo.config.provision.ApplicationId) HashSet(java.util.HashSet)

Example 79 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class NodeRepositoryTest method applicationDefaultFlavor.

@Test
public void applicationDefaultFlavor() {
    NodeRepositoryTester tester = new NodeRepositoryTester();
    ApplicationId application = ApplicationId.from(TenantName.from("a"), ApplicationName.from("b"), InstanceName.from("c"));
    Path path = Path.fromString("/provision/v1/defaultFlavor").append(application.serializedForm());
    String flavor = "example-flavor";
    tester.curator().create(path);
    tester.curator().set(path, flavor.getBytes(StandardCharsets.UTF_8));
    assertEquals(Optional.of(flavor), tester.nodeRepository().getDefaultFlavorOverride(application));
    ApplicationId applicationWithoutDefaultFlavor = ApplicationId.from(TenantName.from("does"), ApplicationName.from("not"), InstanceName.from("exist"));
    assertFalse(tester.nodeRepository().getDefaultFlavorOverride(applicationWithoutDefaultFlavor).isPresent());
}
Also used : Path(com.yahoo.path.Path) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 80 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class InstanceValidatorTest method mockApplicationInfo.

private ApplicationInfo mockApplicationInfo(ApplicationId appId, int numHosts, List<ServiceInfo> serviceInfo) {
    List<HostInfo> hosts = IntStream.range(0, numHosts).mapToObj(i -> new HostInfo("host-" + i + "." + appId.toShortString() + ".yahoo.com", serviceInfo)).collect(Collectors.toList());
    Model model = mock(Model.class);
    when(model.getHosts()).thenReturn(hosts);
    return new ApplicationInfo(appId, 0, model);
}
Also used : IntStream(java.util.stream.IntStream) ApplicationId(com.yahoo.config.provision.ApplicationId) HostInfo(com.yahoo.config.model.api.HostInfo) SuperModelProvider(com.yahoo.config.model.api.SuperModelProvider) SignedIdentityDocument(com.yahoo.vespa.hosted.athenz.instanceproviderservice.identitydocument.SignedIdentityDocument) HashMap(java.util.HashMap) SERVICE_PROPERTIES_DOMAIN_KEY(com.yahoo.vespa.hosted.athenz.instanceproviderservice.instanceconfirmation.InstanceValidator.SERVICE_PROPERTIES_DOMAIN_KEY) Function(java.util.function.Function) IdentityDocument(com.yahoo.vespa.hosted.athenz.instanceproviderservice.identitydocument.IdentityDocument) SERVICE_PROPERTIES_SERVICE_KEY(com.yahoo.vespa.hosted.athenz.instanceproviderservice.instanceconfirmation.InstanceValidator.SERVICE_PROPERTIES_SERVICE_KEY) Map(java.util.Map) KeyProvider(com.yahoo.vespa.hosted.athenz.instanceproviderservice.KeyProvider) ProviderUniqueId(com.yahoo.vespa.hosted.athenz.instanceproviderservice.identitydocument.ProviderUniqueId) SuperModel(com.yahoo.config.model.api.SuperModel) ApplicationInfo(com.yahoo.config.model.api.ApplicationInfo) AutoGeneratedKeyProvider(com.yahoo.vespa.hosted.athenz.instanceproviderservice.AutoGeneratedKeyProvider) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Signature(java.security.Signature) Assert.assertTrue(org.junit.Assert.assertTrue) Utils(com.yahoo.vespa.hosted.athenz.instanceproviderservice.impl.Utils) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) Base64(java.util.Base64) List(java.util.List) Stream(java.util.stream.Stream) PrivateKey(java.security.PrivateKey) Assert.assertFalse(org.junit.Assert.assertFalse) Collections(java.util.Collections) Model(com.yahoo.config.model.api.Model) ServiceInfo(com.yahoo.config.model.api.ServiceInfo) Mockito.mock(org.mockito.Mockito.mock) SuperModel(com.yahoo.config.model.api.SuperModel) Model(com.yahoo.config.model.api.Model) ApplicationInfo(com.yahoo.config.model.api.ApplicationInfo) HostInfo(com.yahoo.config.model.api.HostInfo)

Aggregations

ApplicationId (com.yahoo.config.provision.ApplicationId)173 Test (org.junit.Test)102 Zone (com.yahoo.config.provision.Zone)52 Node (com.yahoo.vespa.hosted.provision.Node)30 ClusterSpec (com.yahoo.config.provision.ClusterSpec)22 TenantName (com.yahoo.config.provision.TenantName)20 Flavor (com.yahoo.config.provision.Flavor)19 List (java.util.List)16 HashSet (java.util.HashSet)15 HostSpec (com.yahoo.config.provision.HostSpec)12 Duration (java.time.Duration)12 HashMap (java.util.HashMap)12 Map (java.util.Map)12 Set (java.util.Set)12 Collectors (java.util.stream.Collectors)12 Version (com.yahoo.component.Version)11 OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)11 Slime (com.yahoo.slime.Slime)11 ArrayList (java.util.ArrayList)11 Optional (java.util.Optional)11