use of com.yahoo.vespa.hosted.provision.node.NodeAcl in project vespa by vespa-engine.
the class AclProvisioningTest method trusted_nodes_for_docker_hosts_nodes_in_zone_application.
@Test
public void trusted_nodes_for_docker_hosts_nodes_in_zone_application() {
// use same id for both allocate calls below
ApplicationId applicationId = tester.makeApplicationId();
List<Node> configServers = setConfigServers("cfg1:1234,cfg2:1234,cfg3:1234");
// Populate repo
tester.makeReadyNodes(2, "default", NodeType.host);
// Allocate 2 Docker hosts
List<Node> activeDockerHostNodes = allocateNodes(NodeType.host, applicationId);
assertEquals(2, activeDockerHostNodes.size());
// Check trusted nodes for all nodes
activeDockerHostNodes.forEach(node -> {
System.out.println("Checking node " + node);
List<NodeAcl> nodeAcls = tester.nodeRepository().getNodeAcls(node, false);
assertAcls(Arrays.asList(activeDockerHostNodes, configServers), dockerBridgeNetwork, nodeAcls);
});
}
use of com.yahoo.vespa.hosted.provision.node.NodeAcl in project vespa by vespa-engine.
the class AclProvisioningTest method trusted_nodes_for_proxy.
@Test
public void trusted_nodes_for_proxy() {
List<Node> configServers = setConfigServers("cfg1:1234,cfg2:1234,cfg3:1234");
// Populate repo
tester.makeReadyNodes(10, "default");
tester.makeReadyNodes(3, "default", NodeType.proxy);
// Deploy zone application
ApplicationId zoneApplication = tester.makeApplicationId();
allocateNodes(Capacity.fromRequiredNodeType(NodeType.proxy), zoneApplication);
// Get trusted nodes for first proxy node
List<Node> proxyNodes = tester.nodeRepository().getNodes(zoneApplication);
Node node = proxyNodes.get(0);
List<NodeAcl> nodeAcls = tester.nodeRepository().getNodeAcls(node, false);
// Trusted nodes is all config servers and all proxy nodes
assertAcls(Arrays.asList(proxyNodes, configServers), nodeAcls);
}
use of com.yahoo.vespa.hosted.provision.node.NodeAcl in project vespa by vespa-engine.
the class AclProvisioningTest method trusted_nodes_for_allocated_node.
@Test
public void trusted_nodes_for_allocated_node() {
List<Node> configServers = setConfigServers("cfg1:1234,cfg2:1234,cfg3:1234");
// Populate repo
tester.makeReadyNodes(10, "default");
List<Node> dockerHost = tester.makeReadyNodes(1, "default", NodeType.host);
tester.makeReadyDockerNodes(1, "default", dockerHost.get(0).id());
List<Node> proxyNodes = tester.makeReadyNodes(3, "default", NodeType.proxy);
// Allocate 2 nodes
List<Node> activeNodes = allocateNodes(2);
assertEquals(2, activeNodes.size());
// Get trusted nodes for the first active node
Node node = activeNodes.get(0);
List<NodeAcl> nodeAcls = tester.nodeRepository().getNodeAcls(node, false);
// Trusted nodes is active nodes in same application, proxy nodes and config servers
assertAcls(Arrays.asList(activeNodes, proxyNodes, configServers, dockerHost), nodeAcls);
}
use of com.yahoo.vespa.hosted.provision.node.NodeAcl in project vespa by vespa-engine.
the class AclProvisioningTest method trusted_nodes_for_config_server.
@Test
public void trusted_nodes_for_config_server() {
List<Node> configServers = setConfigServers("cfg1:1234,cfg2:1234,cfg3:1234");
// Populate repo
tester.makeReadyNodes(10, "default");
List<Node> proxyNodes = tester.makeReadyNodes(3, "default", NodeType.proxy);
// Allocate 2 nodes
allocateNodes(4);
List<Node> tenantNodes = tester.nodeRepository().getNodes(NodeType.tenant);
// Get trusted nodes for the first config server
Node node = tester.nodeRepository().getConfigNode("cfg1").orElseThrow(() -> new RuntimeException("Failed to find cfg1"));
List<NodeAcl> nodeAcls = tester.nodeRepository().getNodeAcls(node, false);
// Trusted nodes is all tenant nodes, all proxy nodes and all config servers
assertAcls(Arrays.asList(tenantNodes, proxyNodes, configServers), nodeAcls);
}
use of com.yahoo.vespa.hosted.provision.node.NodeAcl in project vespa by vespa-engine.
the class AclProvisioningTest method trusted_nodes_for_child_nodes_of_docker_host.
@Test
public void trusted_nodes_for_child_nodes_of_docker_host() {
List<Node> configServers = setConfigServers("cfg1:1234,cfg2:1234,cfg3:1234");
// Populate repo
List<Node> dockerHostNodes = tester.makeReadyNodes(2, "default", NodeType.host);
Node dockerHostNodeUnderTest = dockerHostNodes.get(0);
List<Node> dockerNodes = tester.makeReadyDockerNodes(5, "dockerSmall", dockerHostNodeUnderTest.hostname());
List<NodeAcl> acls = tester.nodeRepository().getNodeAcls(dockerHostNodeUnderTest, true);
// ACLs for each container on the Docker host
assertFalse(dockerNodes.isEmpty());
assertEquals(dockerNodes.size(), acls.size());
for (Node dockerNode : dockerNodes) {
NodeAcl nodeAcl = acls.stream().filter(acl -> acl.node().equals(dockerNode)).findFirst().orElseThrow(() -> new RuntimeException("Expected to find ACL for node " + dockerNode.hostname()));
assertEquals(dockerHostNodeUnderTest.hostname(), dockerNode.parentHostname().get());
assertAcls(Arrays.asList(configServers, dockerNodes), nodeAcl);
}
}
Aggregations