diff options
23 files changed, 293 insertions, 344 deletions
diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java index 4cb0fa7d09e..f065778c979 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -58,6 +58,12 @@ public class Flags { // if any, or otherwise hosted-vespa:tenant-host:default. APPLICATION_ID, TENANT_ID, CLUSTER_ID, CLUSTER_TYPE); + public static final UnboundBooleanFlag SIMPLER_ACL = defineFeatureFlag( + "simpler-acl", true, + List.of("hakonhall"), "2023-07-04", "2023-08-04", + "Simplify ACL in hosted Vespa", + "Takes effect on the next fetch of ACL rules"); + public static final UnboundDoubleFlag DEFAULT_TERM_WISE_LIMIT = defineDoubleFlag( "default-term-wise-limit", 1.0, List.of("baldersheim"), "2020-12-02", "2023-12-31", diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java index 864566f119e..a80f07acba2 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java @@ -616,8 +616,8 @@ public final class Node implements Nodelike { } /** Returns the ACL for the node (trusted nodes, networks and ports) */ - public NodeAcl acl(NodeList allNodes, LoadBalancers loadBalancers, Zone zone) { - return NodeAcl.from(this, allNodes, loadBalancers, zone); + public NodeAcl acl(NodeList allNodes, LoadBalancers loadBalancers, Zone zone, boolean simplerAcl) { + return NodeAcl.from(this, allNodes, loadBalancers, zone, simplerAcl); } @Override diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java index f3d69fdf103..2d4e7142622 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java @@ -215,11 +215,11 @@ public class NodeRepository extends AbstractComponent { * @param host node for which to generate ACLs * @return the list of node ACLs */ - public List<NodeAcl> getChildAcls(Node host) { + public List<NodeAcl> getChildAcls(Node host, boolean simplerAcl) { if ( ! host.type().isHost()) throw new IllegalArgumentException("Only hosts have children"); NodeList allNodes = nodes().list(); return allNodes.childrenOf(host) - .mapToList(childNode -> childNode.acl(allNodes, loadBalancers, zone)); + .mapToList(childNode -> childNode.acl(allNodes, loadBalancers, zone, simplerAcl)); } /** Removes this application: all nodes are set dirty. */ diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/IP.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/IP.java index 1ff6d2b300d..0927ffe3ce2 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/IP.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/IP.java @@ -24,14 +24,12 @@ import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.Set; -import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; import static com.yahoo.config.provision.NodeType.confighost; import static com.yahoo.config.provision.NodeType.controllerhost; import static com.yahoo.config.provision.NodeType.proxyhost; -import static java.util.function.Predicate.not; /** * This handles IP address configuration and allocation. @@ -113,13 +111,13 @@ public record IP() { * * @throws IllegalArgumentException if there are IP conflicts with existing nodes */ - public static LockedNodeList verify(List<Node> nodes, LockedNodeList allNodes) { + public static LockedNodeList verify(List<Node> nodes, LockedNodeList allNodes, Zone zone) { NodeList sortedNodes = allNodes.sortedBy(Comparator.comparing(Node::hostname)); for (var node : nodes) { + Space ipSpace = Space.of(zone, node.cloudAccount()); for (var other : sortedNodes) { if (node.equals(other)) continue; if (canAssignIpOf(other, node)) continue; - Predicate<String> sharedIpSpace = other.cloudAccount().equals(node.cloudAccount()) ? __ -> true : IP::isPublic; var addresses = new HashSet<>(node.ipConfig().primary()); var otherAddresses = new HashSet<>(other.ipConfig().primary()); @@ -127,7 +125,7 @@ public record IP() { addresses.addAll(node.ipConfig().pool().asSet()); otherAddresses.addAll(other.ipConfig().pool().asSet()); } - otherAddresses.removeIf(not(sharedIpSpace)); + otherAddresses.removeIf(otherIp -> !ipSpace.contains(otherIp, other.cloudAccount())); otherAddresses.retainAll(addresses); if (!otherAddresses.isEmpty()) throw new IllegalArgumentException("Cannot assign " + addresses + " to " + node.hostname() + @@ -151,8 +149,8 @@ public record IP() { }; } - public static Node verify(Node node, LockedNodeList allNodes) { - return verify(List.of(node), allNodes).asList().get(0); + public static Node verify(Node node, LockedNodeList allNodes, Zone zone) { + return verify(List.of(node), allNodes, zone).asList().get(0); } } @@ -468,9 +466,33 @@ public record IP() { } /** Returns whether given string is a public IP address */ - public static boolean isPublic(String ip) { + private static boolean isPublic(String ip) { InetAddress address = parse(ip); return ! address.isLoopbackAddress() && ! address.isLinkLocalAddress() && ! address.isSiteLocalAddress(); } + @FunctionalInterface + public interface Space { + static Space of(Zone zone) { return of(zone, zone.cloud().account()); } + + /** Returns the IP space of a cloud account in a zone. */ + static Space of(Zone zone, CloudAccount cloudAccount) { return (ip, account) -> sharedIp(ip, account, cloudAccount, zone); } + + private static boolean sharedIp(String ip, CloudAccount sourceCloudAccount, CloudAccount targetCloudAccount, Zone zone) { + // IPs within the same account and zone are always shared. + if (sourceCloudAccount.equals(targetCloudAccount)) + return true; + + // Only public IPs inside (outside) an exclave account are shared outside (inside). + if (sourceCloudAccount.isExclave(zone) || targetCloudAccount.isExclave(zone)) + return isPublic(ip); + + // IPs in noclave and inclave are always shared. + return true; + } + + /** Returns true if the IP in the given account is in this IP space. */ + boolean contains(String ip, CloudAccount cloudAccount); + } + } diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/NodeAcl.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/NodeAcl.java index 843ba240ce9..7df19c97659 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/NodeAcl.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/NodeAcl.java @@ -11,12 +11,16 @@ import com.yahoo.vespa.hosted.provision.lb.LoadBalancerInstance; import com.yahoo.vespa.hosted.provision.lb.LoadBalancers; import java.util.Comparator; +import java.util.EnumSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.TreeSet; +import java.util.function.Consumer; +import java.util.function.Predicate; +import java.util.stream.Collectors; import java.util.stream.StreamSupport; /** @@ -41,11 +45,12 @@ public record NodeAcl(Node node, this.trustedUdpPorts = ImmutableSet.copyOf(Objects.requireNonNull(trustedUdpPorts, "trustedUdpPorts must be non-null")); } - public static NodeAcl from(Node node, NodeList allNodes, LoadBalancers loadBalancers, Zone zone) { + public static NodeAcl from(Node node, NodeList allNodes, LoadBalancers loadBalancers, Zone zone, boolean simplerAcl) { Set<TrustedNode> trustedNodes = new TreeSet<>(Comparator.comparing(TrustedNode::hostname)); Set<Integer> trustedPorts = new LinkedHashSet<>(); Set<Integer> trustedUdpPorts = new LinkedHashSet<>(); Set<String> trustedNetworks = new LinkedHashSet<>(); + IP.Space ipSpace = simplerAcl ? IP.Space.of(zone, node.cloudAccount()) : (ip, account) -> true; // For all cases below, trust: // - SSH: If the host has one container, and it is using the host's network namespace, @@ -53,12 +58,13 @@ public record NodeAcl(Node node, // SSH opened (which is safe for 2 reasons: SSH daemon is not run inside containers, and NPT networks // will (should) not forward port 22 traffic to container). // - parent host (for health checks and metrics) - // - nodes in same application + // - nodes in same application (Slobrok for tenant nodes, file distribution and ZK for config servers, etc), + // and parents if necessary due to NAT. // - load balancers allocated to application trustedPorts.add(22); - allNodes.parentOf(node).map(TrustedNode::of).ifPresent(trustedNodes::add); + allNodes.parentOf(node).map(parent -> TrustedNode.of(parent, ipSpace)).ifPresent(trustedNodes::add); node.allocation().ifPresent(allocation -> { - trustedNodes.addAll(TrustedNode.of(allNodes.owner(allocation.owner()))); + trustedNodes.addAll(trustedNodesForChildrenMatching(node, allNodes, n -> n.allocation().map(Allocation::owner).equals(Optional.of(allocation.owner())), Set.of(), ipSpace)); loadBalancers.list(allocation.owner()).asList() .stream() .map(LoadBalancer::instance) @@ -72,19 +78,8 @@ public record NodeAcl(Node node, // Tenant nodes in other states than ready, trust: // - config servers // - proxy nodes - // - parents of the nodes in the same application: If some nodes are on a different IP version - // or only a subset of them are dual-stacked, the communication between the nodes may be NAT-ed - // via parent's IP address - trustedNodes.addAll(TrustedNode.of(allNodes.nodeType(NodeType.config))); - trustedNodes.addAll(TrustedNode.of(allNodes.nodeType(NodeType.proxy))); - node.allocation().ifPresent(allocation -> trustedNodes.addAll(TrustedNode.of(allNodes.parentsOf(allNodes.owner(allocation.owner()))))); - if (node.state() == Node.State.ready) { - // Tenant nodes in state ready, trust: - // - All tenant nodes in zone. When a ready node is allocated to an application there's a brief - // window where current ACLs have not yet been applied on the node. To avoid service disruption - // during this window, ready tenant nodes trust all other tenant nodes - trustedNodes.addAll(TrustedNode.of(allNodes.nodeType(NodeType.tenant))); - } + trustedNodes.addAll(TrustedNode.of(allNodes.nodeType(NodeType.config), ipSpace)); + trustedNodes.addAll(TrustedNode.of(allNodes.nodeType(NodeType.proxy), ipSpace)); } case config -> { // Config servers trust: @@ -92,9 +87,7 @@ public record NodeAcl(Node node, // - port 19070 (RPC) from all proxy nodes (and their hosts, in case traffic is NAT-ed via parent) // - port 4443 from the world // - udp port 51820 from the world - trustedNodes.addAll(TrustedNode.of(allNodes.nodeType(NodeType.host, NodeType.tenant, - NodeType.proxyhost, NodeType.proxy), - RPC_PORTS)); + trustedNodes.addAll(trustedNodesForChildrenMatching(node, allNodes, n -> EnumSet.of(NodeType.tenant, NodeType.proxy).contains(n.type()), RPC_PORTS, ipSpace)); trustedPorts.add(4443); if (zone.system().isPublic() && zone.cloud().allowEnclave()) { trustedUdpPorts.add(WIREGUARD_PORT); @@ -104,7 +97,7 @@ public record NodeAcl(Node node, // Proxy nodes trust: // - config servers // - all connections from the world on 443 (production traffic) and 4443 (health checks) - trustedNodes.addAll(TrustedNode.of(allNodes.nodeType(NodeType.config))); + trustedNodes.addAll(TrustedNode.of(allNodes.nodeType(NodeType.config), ipSpace)); trustedPorts.add(443); trustedPorts.add(4443); } @@ -121,26 +114,54 @@ public record NodeAcl(Node node, return new NodeAcl(node, trustedNodes, trustedNetworks, trustedPorts, trustedUdpPorts); } + /** Returns the set of children matching the selector, and their parent host if traffic from child may be NATed */ + private static Set<TrustedNode> trustedNodesForChildrenMatching(Node node, NodeList allNodes, Predicate<Node> childNodeSelector, + Set<Integer> ports, IP.Space ipSpace) { + if (node.type().isHost()) + throw new IllegalArgumentException("Host nodes cannot have NAT parents"); + + boolean hasIp4 = node.ipConfig().primary().stream().anyMatch(IP::isV4); + boolean hasIp6 = node.ipConfig().primary().stream().anyMatch(IP::isV6); + return allNodes.stream() + .filter(n -> !n.type().isHost()) + .filter(childNodeSelector) + .mapMulti((Node otherNode, Consumer<TrustedNode> consumer) -> { + consumer.accept(TrustedNode.of(otherNode, ports, ipSpace)); + + // And parent host if traffic from otherNode may be NATed + if (hasIp4 && otherNode.ipConfig().primary().stream().noneMatch(IP::isV4) || + hasIp6 && otherNode.ipConfig().primary().stream().noneMatch(IP::isV6)) { + consumer.accept(TrustedNode.of(allNodes.parentOf(otherNode).orElseThrow(), ports, ipSpace)); + } + }) + .collect(Collectors.toSet()); + } + public record TrustedNode(String hostname, NodeType type, Set<String> ipAddresses, Set<Integer> ports) { - /** Trust given ports from node */ - public static TrustedNode of(Node node, Set<Integer> ports) { - return new TrustedNode(node.hostname(), node.type(), node.ipConfig().primary(), ports); + /** Trust given ports from node, and primary IP addresses shared with given cloud account */ + public static TrustedNode of(Node node, Set<Integer> ports, IP.Space ipSpace) { + Set<String> ipAddresses = node.ipConfig() + .primary() + .stream() + .filter(ip -> ipSpace.contains(ip, node.cloudAccount())) + .collect(Collectors.toSet()); + return new TrustedNode(node.hostname(), node.type(), ipAddresses, ports); } - /** Trust all ports from given node */ - public static TrustedNode of(Node node) { - return of(node, Set.of()); + /** The node in the given sourceCloudAccount should trust all ports from given node */ + public static TrustedNode of(Node node, IP.Space ipSpace) { + return of(node, Set.of(), ipSpace); } - public static List<TrustedNode> of(Iterable<Node> nodes, Set<Integer> ports) { + public static List<TrustedNode> of(Iterable<Node> nodes, Set<Integer> ports, IP.Space ipSpace) { return StreamSupport.stream(nodes.spliterator(), false) - .map(node -> TrustedNode.of(node, ports)) + .map(node -> TrustedNode.of(node, ports, ipSpace)) .toList(); } - public static List<TrustedNode> of(Iterable<Node> nodes) { - return of(nodes, Set.of()); + public static List<TrustedNode> of(Iterable<Node> nodes, IP.Space ipSpace) { + return of(nodes, Set.of(), ipSpace); } } diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java index 0bb045dc6a1..560abb1f0e8 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java @@ -200,7 +200,7 @@ public class Nodes { } NestedTransaction transaction = new NestedTransaction(); db.removeNodes(nodesToRemove, transaction); - List<Node> resultingNodes = db.addNodesInState(IP.Config.verify(nodesToAdd, list(allocationLock)), Node.State.provisioned, agent, transaction); + List<Node> resultingNodes = db.addNodesInState(IP.Config.verify(nodesToAdd, list(allocationLock), zone), Node.State.provisioned, agent, transaction); transaction.commit(); return resultingNodes; } diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodeAclResponse.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodeAclResponse.java index 6fe14715355..784f8f82d14 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodeAclResponse.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodeAclResponse.java @@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.provision.restapi; import com.yahoo.container.jdisc.HttpRequest; import com.yahoo.restapi.SlimeJsonResponse; import com.yahoo.slime.Cursor; +import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.hosted.provision.Node; import com.yahoo.vespa.hosted.provision.NodeRepository; import com.yahoo.vespa.hosted.provision.node.NodeAcl; @@ -33,8 +34,9 @@ public class NodeAclResponse extends SlimeJsonResponse { Node node = nodeRepository.nodes().node(hostname) .orElseThrow(() -> new NotFoundException("No node with hostname '" + hostname + "'")); - List<NodeAcl> acls = aclsForChildren ? nodeRepository.getChildAcls(node) : - List.of(node.acl(nodeRepository.nodes().list(), nodeRepository.loadBalancers(), nodeRepository.zone())); + boolean simplerAcl = Flags.SIMPLER_ACL.bindTo(nodeRepository.flagSource()).value(); + List<NodeAcl> acls = aclsForChildren ? nodeRepository.getChildAcls(node, simplerAcl) : + List.of(node.acl(nodeRepository.nodes().list(), nodeRepository.loadBalancers(), nodeRepository.zone(), simplerAcl)); Cursor trustedNodesArray = object.setArray("trustedNodes"); acls.forEach(nodeAcl -> toSlime(nodeAcl, trustedNodesArray)); diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodePatcher.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodePatcher.java index 32bba9336a2..d88cade0022 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodePatcher.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodePatcher.java @@ -281,9 +281,9 @@ public class NodePatcher { private Node applyIpconfigField(Node node, String name, Inspector value, LockedNodeList nodes) { return switch (name) { - case "ipAddresses" -> IP.Config.verify(node.with(node.ipConfig().withPrimary(asStringSet(value))), nodes); - case "additionalIpAddresses" -> IP.Config.verify(node.with(node.ipConfig().withPool(node.ipConfig().pool().withIpAddresses(asStringSet(value)))), nodes); - case "additionalHostnames" -> IP.Config.verify(node.with(node.ipConfig().withPool(node.ipConfig().pool().withHostnames(asHostnames(value)))), nodes); + case "ipAddresses" -> IP.Config.verify(node.with(node.ipConfig().withPrimary(asStringSet(value))), nodes, nodeRepository.zone()); + case "additionalIpAddresses" -> IP.Config.verify(node.with(node.ipConfig().withPool(node.ipConfig().pool().withIpAddresses(asStringSet(value)))), nodes, nodeRepository.zone()); + case "additionalHostnames" -> IP.Config.verify(node.with(node.ipConfig().withPool(node.ipConfig().pool().withHostnames(asHostnames(value)))), nodes, nodeRepository.zone()); default -> throw new IllegalArgumentException("Could not apply field '" + name + "' on a node: No such modifiable field"); }; } diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockNodeRepository.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockNodeRepository.java index 26478d2b566..e3f67721eb5 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockNodeRepository.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockNodeRepository.java @@ -130,7 +130,7 @@ public class MockNodeRepository extends NodeRepository { .status(Status.initial() .withVespaVersion(new Version("1.2.3")) .withContainerImage(DockerImage.fromString("docker-registry.domain.tld:8080/dist/vespa:1.2.3"))) - .cloudAccount(defaultCloudAccount) + .cloudAccount(tenantAccount) .build(); nodes.add(node5); @@ -175,9 +175,11 @@ public class MockNodeRepository extends NodeRepository { // Config servers nodes.add(Node.create("cfg1", ipConfig(201), "cfg1.yahoo.com", flavors.getFlavorOrThrow("default"), NodeType.config) - .wireguardPubKey(WireguardKey.from("lololololololololololololololololololololoo=")).build()); + .cloudAccount(defaultCloudAccount) + .wireguardPubKey(WireguardKey.from("lololololololololololololololololololololoo=")).build()); nodes.add(Node.create("cfg2", ipConfig(202), "cfg2.yahoo.com", flavors.getFlavorOrThrow("default"), NodeType.config) - .build()); + .cloudAccount(defaultCloudAccount) + .build()); // Ready all nodes, except 7 and 55 nodes = new ArrayList<>(nodes().addNodes(nodes, Agent.system)); @@ -245,8 +247,8 @@ public class MockNodeRepository extends NodeRepository { activate(provisioner.prepare(app3, cluster3, Capacity.from(new ClusterResources(2, 1, new NodeResources(1, 4, 100, 1)), false, true), null), app3, provisioner); List<Node> largeNodes = new ArrayList<>(); - largeNodes.add(Node.create("node13", ipConfig(13), "host13.yahoo.com", resources(10, 48, 500, 1, fast, local), NodeType.tenant).build()); - largeNodes.add(Node.create("node14", ipConfig(14), "host14.yahoo.com", resources(10, 48, 500, 1, fast, local), NodeType.tenant).build()); + largeNodes.add(Node.create("node13", ipConfig(13), "host13.yahoo.com", resources(10, 48, 500, 1, fast, local), NodeType.tenant).cloudAccount(defaultCloudAccount).build()); + largeNodes.add(Node.create("node14", ipConfig(14), "host14.yahoo.com", resources(10, 48, 500, 1, fast, local), NodeType.tenant).cloudAccount(defaultCloudAccount).build()); nodes().addNodes(largeNodes, Agent.system); largeNodes.forEach(node -> nodes().setReady(new NodeMutex(node, () -> {}), Agent.system, getClass().getSimpleName())); ApplicationId app4 = ApplicationId.from(TenantName.from("tenant4"), ApplicationName.from("application4"), InstanceName.from("instance4")); diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/NodeRepositoryTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/NodeRepositoryTest.java index 605bf514f03..5148d2a635c 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/NodeRepositoryTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/NodeRepositoryTest.java @@ -1,8 +1,14 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.provision; +import com.yahoo.config.provision.Cloud; import com.yahoo.config.provision.CloudAccount; +import com.yahoo.config.provision.CloudName; +import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.NodeType; +import com.yahoo.config.provision.RegionName; +import com.yahoo.config.provision.SystemName; +import com.yahoo.config.provision.Zone; import com.yahoo.vespa.hosted.provision.node.Agent; import com.yahoo.vespa.hosted.provision.node.History; import com.yahoo.vespa.hosted.provision.node.IP; @@ -53,7 +59,11 @@ public class NodeRepositoryTest { @Test public void test_ip_conflicts() { - NodeRepositoryTester tester = new NodeRepositoryTester(); + var zone = new Zone(Cloud.builder().name(CloudName.AWS).account(CloudAccount.from("aws:123456789012")).allowEnclave(true).build(), + SystemName.Public, + Environment.prod, + RegionName.from("aws-us-east-1a")); + NodeRepositoryTester tester = new NodeRepositoryTester(zone); IP.Config ipConfig = IP.Config.of(Set.of("1.2.3.4", "10.2.3.4"), Set.of("1.2.3.4", "10.2.3.4")); IP.Config publicIpConfig = IP.Config.of(Set.of("1.2.3.4"), Set.of("1.2.3.4")); IP.Config privateIpConfig = IP.Config.of(Set.of("10.2.3.4"), Set.of("10.2.3.4")); diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/NodeRepositoryTester.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/NodeRepositoryTester.java index 00c4d95b0da..49702a7d4c1 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/NodeRepositoryTester.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/NodeRepositoryTester.java @@ -33,6 +33,10 @@ public class NodeRepositoryTester { private final MockCurator curator; public NodeRepositoryTester() { + this(Zone.defaultZone()); + } + + public NodeRepositoryTester(Zone zone) { nodeFlavors = new NodeFlavors(createConfig()); clock = new ManualClock(); curator = new MockCurator(); @@ -41,7 +45,7 @@ public class NodeRepositoryTester { new EmptyProvisionServiceProvider(), curator, clock, - Zone.defaultZone(), + zone, new MockNameResolver().mockAnyLookup(), DockerImage.fromString("docker-registry.domain.tld:8080/dist/vespa"), Optional.empty(), diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/AclProvisioningTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/AclProvisioningTest.java index 50eeef69448..26925372b93 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/AclProvisioningTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/AclProvisioningTest.java @@ -15,6 +15,7 @@ import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.Zone; import com.yahoo.vespa.hosted.provision.Node; import com.yahoo.vespa.hosted.provision.NodeList; +import com.yahoo.vespa.hosted.provision.node.IP; import com.yahoo.vespa.hosted.provision.node.NodeAcl; import com.yahoo.vespa.hosted.provision.node.NodeAcl.TrustedNode; import org.junit.Test; @@ -57,32 +58,35 @@ public class AclProvisioningTest { // Get trusted nodes for the first active node Node node = activeNodes.get(0); List<Node> hostOfNode = node.parentHostname().flatMap(tester.nodeRepository().nodes()::node).map(List::of).orElseGet(List::of); - Supplier<NodeAcl> nodeAcls = () -> node.acl(tester.nodeRepository().nodes().list(), tester.nodeRepository().loadBalancers(), tester.nodeRepository().zone()); + Supplier<NodeAcl> nodeAcls = () -> node.acl(tester.nodeRepository().nodes().list(), tester.nodeRepository().loadBalancers(), tester.nodeRepository().zone(), true); // Trusted nodes are active nodes in same application, proxy nodes and config servers - assertAcls(trustedNodesOf(List.of(activeNodes, proxyNodes, configServers.asList(), hostOfNode)), + assertAcls(trustedNodesOf(List.of(activeNodes, proxyNodes, configServers.asList(), hostOfNode), node.cloudAccount()), Set.of("10.2.3.0/24", "10.4.5.0/24"), List.of(nodeAcls.get())); } @Test - public void trusted_nodes_for_unallocated_node() { + public void trusted_nodes_for_parked_node() { NodeList configServers = tester.makeConfigServers(3, "default", Version.fromString("6.123.456")); // Populate repo - tester.makeReadyNodes(10, nodeResources); + List<Node> tenantNodes = tester.makeReadyNodes(10, nodeResources); List<Node> proxyNodes = tester.makeReadyNodes(3, "default", NodeType.proxy); // Allocate 2 nodes to an application - deploy(2); + Set<String> deployedTenantNodes = deploy(2).stream().map(Node::hostname).collect(Collectors.toSet()); + + tester.move(Node.State.parked, tenantNodes.stream() + .filter(node -> !deployedTenantNodes.contains(node.hostname())) + .toList()); - // Get trusted nodes for a ready tenant node - Node node = tester.nodeRepository().nodes().list(Node.State.ready).nodeType(NodeType.tenant).first().get(); - NodeAcl nodeAcl = node.acl(tester.nodeRepository().nodes().list(), tester.nodeRepository().loadBalancers(), tester.nodeRepository().zone()); - NodeList tenantNodes = tester.nodeRepository().nodes().list().nodeType(NodeType.tenant); + // Get trusted nodes for a parked tenant node + Node node = tester.nodeRepository().nodes().list(Node.State.parked).nodeType(NodeType.tenant).first().get(); + NodeAcl nodeAcl = node.acl(tester.nodeRepository().nodes().list(), tester.nodeRepository().loadBalancers(), tester.nodeRepository().zone(), true); - // Trusted nodes are all proxy-, config-, and, tenant-nodes - assertAcls(trustedNodesOf(List.of(proxyNodes, configServers.asList(), tenantNodes.asList())), List.of(nodeAcl)); + // Trusted nodes are all config-nodes + assertAcls(trustedNodesOf(List.of(proxyNodes, configServers.asList()), node.cloudAccount()), List.of(nodeAcl)); } @Test @@ -104,14 +108,16 @@ public class AclProvisioningTest { // Get trusted nodes for the first config server Node node = tester.nodeRepository().nodes().node("cfg1") .orElseThrow(() -> new RuntimeException("Failed to find cfg1")); - NodeAcl nodeAcl = node.acl(nodes, tester.nodeRepository().loadBalancers(), tester.nodeRepository().zone()); - - // Trusted nodes is all tenant nodes+hosts, all proxy nodes+hosts, all config servers and load balancer subnets - assertAcls(List.of(TrustedNode.of(tenantHosts, Set.of(19070)), - TrustedNode.of(tenantNodes, Set.of(19070)), - TrustedNode.of(proxyHosts, Set.of(19070)), - TrustedNode.of(proxyNodes, Set.of(19070)), - TrustedNode.of(configNodes)), + NodeAcl nodeAcl = node.acl(nodes, tester.nodeRepository().loadBalancers(), tester.nodeRepository().zone(), true); + + // Trusted nodes is all tenant nodes, all proxy nodes, all config servers and load balancer subnets + // All tenant hosts because nodes are IPv6 and cfg are IPv4, so traffic is NATed. + // NOT proxy hosts because proxies are dual-stacked so no NAT is needed + IP.Space ipSpace = IP.Space.of(tester.nodeRepository().zone(), node.cloudAccount()); + assertAcls(List.of(TrustedNode.of(tenantHosts, Set.of(19070), ipSpace), + TrustedNode.of(tenantNodes, Set.of(19070), ipSpace), + TrustedNode.of(proxyNodes, Set.of(19070), ipSpace), + TrustedNode.of(configNodes, ipSpace)), Set.of("10.2.3.0/24", "10.4.5.0/24"), List.of(nodeAcl)); assertEquals(Set.of(22, 4443), nodeAcl.trustedPorts()); @@ -122,7 +128,7 @@ public class AclProvisioningTest { publicTester.makeConfigServers(3, "default", Version.fromString("6.123.456")); Node publicCfgNode = publicTester.nodeRepository().nodes().node("cfg1") .orElseThrow(() -> new RuntimeException("Failed to find cfg1")); - NodeAcl publicNodeAcl = publicCfgNode.acl(nodes, publicTester.nodeRepository().loadBalancers(), publicTester.nodeRepository().zone()); + NodeAcl publicNodeAcl = publicCfgNode.acl(nodes, publicTester.nodeRepository().loadBalancers(), publicTester.nodeRepository().zone(), true); assertEquals(Set.of(51820), publicNodeAcl.trustedUdpPorts()); } @@ -140,10 +146,10 @@ public class AclProvisioningTest { // Get trusted nodes for first proxy node NodeList proxyNodes = tester.nodeRepository().nodes().list().nodeType(NodeType.proxy); Node node = proxyNodes.first().get(); - NodeAcl nodeAcl = node.acl(tester.nodeRepository().nodes().list(), tester.nodeRepository().loadBalancers(), tester.nodeRepository().zone()); + NodeAcl nodeAcl = node.acl(tester.nodeRepository().nodes().list(), tester.nodeRepository().loadBalancers(), tester.nodeRepository().zone(), true); // Trusted nodes is all config servers and all proxy nodes - assertAcls(trustedNodesOf(List.of(proxyNodes.asList(), configServers.asList())), List.of(nodeAcl)); + assertAcls(trustedNodesOf(List.of(proxyNodes.asList(), configServers.asList()), node.cloudAccount()), List.of(nodeAcl)); assertEquals(Set.of(22, 443, 4443), nodeAcl.trustedPorts()); assertEquals(Set.of(), nodeAcl.trustedUdpPorts()); } @@ -158,7 +164,7 @@ public class AclProvisioningTest { List<Node> nodes = tester.makeReadyChildren(5, new NodeResources(1, 4, 10, 1), host.hostname()); - List<NodeAcl> acls = tester.nodeRepository().getChildAcls(host); + List<NodeAcl> acls = tester.nodeRepository().getChildAcls(host, true); // ACLs for each container on the host assertFalse(nodes.isEmpty()); @@ -169,7 +175,7 @@ public class AclProvisioningTest { .findFirst() .orElseThrow(() -> new RuntimeException("Expected to find ACL for node " + node.hostname())); assertEquals(host.hostname(), node.parentHostname().get()); - assertAcls(trustedNodesOf(List.of(configServers.asList(), nodes, List.of(host))), nodeAcl); + assertAcls(trustedNodesOf(List.of(configServers.asList(), List.of(host)), node.cloudAccount()), nodeAcl); } } @@ -182,8 +188,8 @@ public class AclProvisioningTest { List<Node> controllers = tester.nodeRepository().nodes().list().nodeType(NodeType.controller).asList(); // Controllers and hosts all trust each other - NodeAcl controllerAcl = controllers.get(0).acl(tester.nodeRepository().nodes().list(), tester.nodeRepository().loadBalancers(), tester.nodeRepository().zone()); - assertAcls(trustedNodesOf(List.of(controllers)), Set.of("10.2.3.0/24", "10.4.5.0/24"), List.of(controllerAcl)); + NodeAcl controllerAcl = controllers.get(0).acl(tester.nodeRepository().nodes().list(), tester.nodeRepository().loadBalancers(), tester.nodeRepository().zone(), true); + assertAcls(trustedNodesOf(List.of(controllers), controllers.get(0).cloudAccount()), Set.of("10.2.3.0/24", "10.4.5.0/24"), List.of(controllerAcl)); assertEquals(Set.of(22, 4443, 443), controllerAcl.trustedPorts()); assertEquals(Set.of(), controllerAcl.trustedUdpPorts()); } @@ -211,7 +217,7 @@ public class AclProvisioningTest { // ACL for nodes with allocation trust their respective load balancer networks, if any for (var host : hosts) { - List<NodeAcl> acls = tester.nodeRepository().getChildAcls(host); + List<NodeAcl> acls = tester.nodeRepository().getChildAcls(host, true); assertEquals(2, acls.size()); for (var acl : acls) { if (acl.node().allocation().isPresent()) { @@ -229,19 +235,20 @@ public class AclProvisioningTest { tester.makeConfigServers(3, "default", Version.fromString("6.123.456")); List<Node> readyNodes = tester.makeReadyNodes(1, "default", NodeType.proxy); - NodeAcl nodeAcl = readyNodes.get(0).acl(tester.nodeRepository().nodes().list(), tester.nodeRepository().loadBalancers(), tester.nodeRepository().zone()); + NodeAcl nodeAcl = readyNodes.get(0).acl(tester.nodeRepository().nodes().list(), tester.nodeRepository().loadBalancers(), tester.nodeRepository().zone(), true); assertEquals(3, nodeAcl.trustedNodes().size()); assertEquals(List.of(Set.of("127.0.1.1"), Set.of("127.0.1.2"), Set.of("127.0.1.3")), nodeAcl.trustedNodes().stream().map(TrustedNode::ipAddresses).toList()); } - private static List<List<TrustedNode>> trustedNodesOf(List<List<Node>> nodes, Set<Integer> ports) { - return nodes.stream().map(node -> TrustedNode.of(node, ports)).toList(); + private List<List<TrustedNode>> trustedNodesOf(List<List<Node>> nodes, Set<Integer> ports, CloudAccount cloudAccount) { + IP.Space ipSpace = IP.Space.of(tester.nodeRepository().zone(), cloudAccount); + return nodes.stream().map(node -> TrustedNode.of(node, ports, ipSpace)).toList(); } - private static List<List<TrustedNode>> trustedNodesOf(List<List<Node>> nodes) { - return trustedNodesOf(nodes, Set.of()); + private List<List<TrustedNode>> trustedNodesOf(List<List<Node>> nodes, CloudAccount cloudAccount) { + return trustedNodesOf(nodes, Set.of(), cloudAccount); } private List<Node> deploy(int nodeCount) { diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiTest.java index 53b1a3bcb89..7769523f3d6 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiTest.java @@ -459,8 +459,8 @@ public class NodesV2ApiTest { } @Test - public void acl_request_by_tenant_node() throws Exception { - assertFile(new Request("http://localhost:8080/nodes/v2/acl/host3.yahoo.com"), "acl-tenant-node.json"); + public void acls_for_inclave_tenant_host() throws Exception { + assertFile(new Request("http://localhost:8080/nodes/v2/acl/host5.yahoo.com"), "acl-tenant-node.json"); } @Test diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-config-server.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-config-server.json index 1800dcacc3d..e3b487325f8 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-config-server.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-config-server.json @@ -3,256 +3,250 @@ { "hostname": "cfg1.yahoo.com", "type": "config", - "ipAddress": "127.0.201.1", + "ipAddress": "::201:1", "trustedBy": "cfg1.yahoo.com" }, { "hostname": "cfg1.yahoo.com", "type": "config", - "ipAddress": "::201:1", + "ipAddress": "127.0.201.1", "trustedBy": "cfg1.yahoo.com" }, { "hostname": "cfg2.yahoo.com", "type": "config", - "ipAddress": "127.0.202.1", + "ipAddress": "::202:1", "trustedBy": "cfg1.yahoo.com" }, { "hostname": "cfg2.yahoo.com", "type": "config", - "ipAddress": "::202:1", - "trustedBy": "cfg1.yahoo.com" - }, - { - "hostname": "dockerhost1.yahoo.com", - "type": "host", - "ipAddress": "127.0.100.1", - "ports": [19070], - "trustedBy": "cfg1.yahoo.com" - }, - { - "hostname": "dockerhost1.yahoo.com", - "type": "host", - "ipAddress": "::100:1", - "ports": [19070], - "trustedBy": "cfg1.yahoo.com" - }, - { - "hostname": "dockerhost2.yahoo.com", - "type": "host", - "ipAddress": "127.0.101.1", - "ports": [19070], - "trustedBy": "cfg1.yahoo.com" - }, - { - "hostname": "dockerhost2.yahoo.com", - "type": "host", - "ipAddress": "::101:1", - "ports": [19070], - "trustedBy": "cfg1.yahoo.com" - }, - { - "hostname": "dockerhost3.yahoo.com", - "type": "host", - "ipAddress": "127.0.102.1", - "ports": [19070], + "ipAddress": "127.0.202.1", "trustedBy": "cfg1.yahoo.com" }, { "hostname": "dockerhost3.yahoo.com", "type": "host", "ipAddress": "::102:1", - "ports": [19070], + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { - "hostname": "dockerhost4.yahoo.com", - "type": "host", - "ipAddress": "127.0.103.1", - "ports": [19070], - "trustedBy": "cfg1.yahoo.com" - }, - { - "hostname": "dockerhost4.yahoo.com", - "type": "host", - "ipAddress": "::103:1", - "ports": [19070], - "trustedBy": "cfg1.yahoo.com" - }, - { - "hostname": "dockerhost5.yahoo.com", - "type": "host", - "ipAddress": "127.0.104.1", - "ports": [19070], - "trustedBy": "cfg1.yahoo.com" - }, - { - "hostname": "dockerhost5.yahoo.com", + "hostname": "dockerhost3.yahoo.com", "type": "host", - "ipAddress": "::104:1", - "ports": [19070], + "ipAddress": "127.0.102.1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host1.yahoo.com", "type": "tenant", - "ipAddress": "127.0.1.1", - "ports": [19070], + "ipAddress": "::1:1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host1.yahoo.com", "type": "tenant", - "ipAddress": "::1:1", - "ports": [19070], + "ipAddress": "127.0.1.1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host10.yahoo.com", "type": "tenant", - "ipAddress": "127.0.10.1", - "ports": [19070], + "ipAddress": "::10:1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host10.yahoo.com", "type": "tenant", - "ipAddress": "::10:1", - "ports": [19070], + "ipAddress": "127.0.10.1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host13.yahoo.com", "type": "tenant", "ipAddress": "127.0.13.1", - "ports": [19070], + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host13.yahoo.com", "type": "tenant", "ipAddress": "::13:1", - "ports": [19070], + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host14.yahoo.com", "type": "tenant", - "ipAddress": "127.0.14.1", - "ports": [19070], + "ipAddress": "::14:1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host14.yahoo.com", "type": "tenant", - "ipAddress": "::14:1", - "ports": [19070], + "ipAddress": "127.0.14.1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host2.yahoo.com", "type": "tenant", - "ipAddress": "127.0.2.1", - "ports": [19070], + "ipAddress": "::2:1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host2.yahoo.com", "type": "tenant", - "ipAddress": "::2:1", - "ports": [19070], + "ipAddress": "127.0.2.1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host3.yahoo.com", "type": "tenant", "ipAddress": "127.0.3.1", - "ports": [19070], + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host3.yahoo.com", "type": "tenant", "ipAddress": "::3:1", - "ports": [19070], + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host4.yahoo.com", "type": "tenant", "ipAddress": "127.0.4.1", - "ports": [19070], + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host4.yahoo.com", "type": "tenant", "ipAddress": "::4:1", - "ports": [19070], + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host5.yahoo.com", "type": "tenant", - "ipAddress": "127.0.5.1", - "ports": [19070], + "ipAddress": "::5:1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host5.yahoo.com", "type": "tenant", - "ipAddress": "::5:1", - "ports": [19070], + "ipAddress": "127.0.5.1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host55.yahoo.com", "type": "tenant", - "ipAddress": "127.0.55.1", - "ports": [19070], + "ipAddress": "::55:1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host55.yahoo.com", "type": "tenant", - "ipAddress": "::55:1", - "ports": [19070], + "ipAddress": "127.0.55.1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host6.yahoo.com", "type": "tenant", "ipAddress": "127.0.6.1", - "ports": [19070], + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host6.yahoo.com", "type": "tenant", "ipAddress": "::6:1", - "ports": [19070], + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host7.yahoo.com", "type": "tenant", - "ipAddress": "127.0.7.1", - "ports": [19070], + "ipAddress": "::7:1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "host7.yahoo.com", "type": "tenant", - "ipAddress": "::7:1", - "ports": [19070], + "ipAddress": "127.0.7.1", + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" }, { "hostname": "test-node-pool-102-2", "type": "tenant", "ipAddress": "::102:2", - "ports": [19070], + "ports": [ + 19070 + ], "trustedBy": "cfg1.yahoo.com" } ], @@ -268,14 +262,13 @@ ], "trustedPorts": [ { - "port":22, - "trustedBy":"cfg1.yahoo.com" + "port": 22, + "trustedBy": "cfg1.yahoo.com" }, { "port": 4443, "trustedBy": "cfg1.yahoo.com" } ], - "trustedUdpPorts": [ - ] + "trustedUdpPorts": [] } diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-tenant-node.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-tenant-node.json index bdc0dc21c95..98a7c5f9036 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-tenant-node.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-tenant-node.json @@ -3,171 +3,45 @@ { "hostname": "cfg1.yahoo.com", "type": "config", - "ipAddress": "127.0.201.1", - "trustedBy": "host3.yahoo.com" + "ipAddress": "::201:1", + "trustedBy": "host5.yahoo.com" }, { "hostname": "cfg1.yahoo.com", "type": "config", - "ipAddress": "::201:1", - "trustedBy": "host3.yahoo.com" + "ipAddress": "127.0.201.1", + "trustedBy": "host5.yahoo.com" }, { "hostname": "cfg2.yahoo.com", "type": "config", - "ipAddress": "127.0.202.1", - "trustedBy": "host3.yahoo.com" + "ipAddress": "::202:1", + "trustedBy": "host5.yahoo.com" }, { "hostname": "cfg2.yahoo.com", "type": "config", - "ipAddress": "::202:1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host1.yahoo.com", - "type": "tenant", - "ipAddress": "127.0.1.1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host1.yahoo.com", - "type": "tenant", - "ipAddress": "::1:1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host10.yahoo.com", - "type": "tenant", - "ipAddress": "127.0.10.1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host10.yahoo.com", - "type": "tenant", - "ipAddress": "::10:1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host13.yahoo.com", - "type": "tenant", - "ipAddress": "127.0.13.1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host13.yahoo.com", - "type": "tenant", - "ipAddress": "::13:1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host14.yahoo.com", - "type": "tenant", - "ipAddress": "127.0.14.1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host14.yahoo.com", - "type": "tenant", - "ipAddress": "::14:1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host2.yahoo.com", - "type": "tenant", - "ipAddress": "127.0.2.1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host2.yahoo.com", - "type": "tenant", - "ipAddress": "::2:1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host3.yahoo.com", - "type": "tenant", - "ipAddress": "127.0.3.1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host3.yahoo.com", - "type": "tenant", - "ipAddress": "::3:1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host4.yahoo.com", - "type": "tenant", - "ipAddress": "127.0.4.1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host4.yahoo.com", - "type": "tenant", - "ipAddress": "::4:1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host5.yahoo.com", - "type": "tenant", - "ipAddress": "127.0.5.1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host5.yahoo.com", - "type": "tenant", - "ipAddress": "::5:1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host55.yahoo.com", - "type": "tenant", - "ipAddress": "127.0.55.1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host55.yahoo.com", - "type": "tenant", - "ipAddress": "::55:1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host6.yahoo.com", - "type": "tenant", - "ipAddress": "127.0.6.1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host6.yahoo.com", - "type": "tenant", - "ipAddress": "::6:1", - "trustedBy": "host3.yahoo.com" - }, - { - "hostname": "host7.yahoo.com", - "type": "tenant", - "ipAddress": "127.0.7.1", - "trustedBy": "host3.yahoo.com" + "ipAddress": "127.0.202.1", + "trustedBy": "host5.yahoo.com" }, { - "hostname": "host7.yahoo.com", - "type": "tenant", - "ipAddress": "::7:1", - "trustedBy": "host3.yahoo.com" + "hostname": "dockerhost2.yahoo.com", + "type": "host", + "ipAddress": "::101:1", + "trustedBy": "host5.yahoo.com" }, { - "hostname": "test-node-pool-102-2", - "type": "tenant", - "ipAddress": "::102:2", - "trustedBy": "host3.yahoo.com" + "hostname": "dockerhost2.yahoo.com", + "type": "host", + "ipAddress": "127.0.101.1", + "trustedBy": "host5.yahoo.com" } ], "trustedNetworks": [], "trustedPorts": [ { "port": 22, - "trustedBy": "host3.yahoo.com" + "trustedBy": "host5.yahoo.com" } ], "trustedUdpPorts": [] diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg1.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg1.json index bd251567f16..fc72d9e08cc 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg1.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg1.json @@ -118,5 +118,6 @@ "::201:1" ], "additionalIpAddresses": [], + "cloudAccount": "aws:111222333444", "wireguardPubkey":"lololololololololololololololololololololoo=" } diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg2.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg2.json index 022512359cd..7f9830ac1e8 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg2.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg2.json @@ -117,5 +117,6 @@ "127.0.202.1", "::202:1" ], - "additionalIpAddresses": [] + "additionalIpAddresses": [], + "cloudAccount": "aws:111222333444" } diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/enclave-nodes-recursive.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/enclave-nodes-recursive.json index 540a0086cbf..3e41d87dd4a 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/enclave-nodes-recursive.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/enclave-nodes-recursive.json @@ -1,6 +1,7 @@ { "nodes": [ @include(docker-node2.json), - @include(node3.json) + @include(node3.json), + @include(node5.json) ] } diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/enclave-nodes.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/enclave-nodes.json index 33fd4daa699..fa34aca85c8 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/enclave-nodes.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/enclave-nodes.json @@ -5,6 +5,9 @@ }, { "url":"http://localhost:8080/nodes/v2/node/host3.yahoo.com" + }, + { + "url":"http://localhost:8080/nodes/v2/node/host5.yahoo.com" } ] } diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node13.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node13.json index bae82bb264a..a0b00877dca 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node13.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node13.json @@ -77,5 +77,6 @@ "127.0.13.1", "::13:1" ], - "additionalIpAddresses": [] + "additionalIpAddresses": [], + "cloudAccount": "aws:111222333444" } diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node14.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node14.json index 12e6f026205..6657f6ba609 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node14.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node14.json @@ -77,5 +77,6 @@ "127.0.14.1", "::14:1" ], - "additionalIpAddresses": [] + "additionalIpAddresses": [], + "cloudAccount": "aws:111222333444" } diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5-after-changes.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5-after-changes.json index abe615bc99f..015a52d3446 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5-after-changes.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5-after-changes.json @@ -75,5 +75,5 @@ ], "ipAddresses": ["127.0.5.1", "::5:1"], "additionalIpAddresses": [], - "cloudAccount": "aws:111222333444" + "cloudAccount": "aws:777888999000" } diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5.json index 98f019f0c0d..900f360bc9e 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5.json @@ -77,5 +77,5 @@ ], "ipAddresses": ["127.0.5.1", "::5:1"], "additionalIpAddresses": [], - "cloudAccount": "aws:111222333444" + "cloudAccount": "aws:777888999000" } |