mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(eks): name EKS Auto Mode nodes by their instance ID, as AWS does (#9631)
An EKS Auto Mode node was named by its instance's private DNS name, as managed node groups' nodes are, where AWS names Auto Mode's nodes by their instance ID. The Ready node Floci registers for an Auto Mode instance now takes the instance ID as its name and its kubernetes.io/hostname label, and keeps the private DNS name as its InternalDNS and Hostname addresses, as on AWS. Node DNS answers and forwarding rules still use the private DNS name. A cluster kept from before this change has its Auto Mode nodes under their private DNS names. Once such a node registers again under its instance ID, Auto Mode's stray-node sweep deletes the DNS-named node, only when its provider ID is that instance's, whether the instance is live or terminated.
This commit is contained in:
1 parent
e20b3ff8dc
commit
885874f5a4
6 files changed
+168
-32
No files matched your search
@@ -496,7 +496,10 @@ launches nodes on AWS. Floci checks every 10 seconds.
|
||||
labels and taints, so no pod the taints keep off lands there first; Floci's own Ready node for a joined instance
|
||||
honours those flags too. The labels are: `karpenter.sh/nodepool`,
|
||||
`eks.amazonaws.com/compute-type: auto`, `node.kubernetes.io/instance-type`, `karpenter.sh/capacity-type`, and the
|
||||
`eks.amazonaws.com/instance-*` category, generation, family, size, CPU and memory labels.
|
||||
`eks.amazonaws.com/instance-*` category, generation, family, size, CPU and memory labels. The node is named by its
|
||||
instance ID (`i-0123456789abcdef0`), as are its `kubernetes.io/hostname` label, as AWS names Auto Mode's nodes; its
|
||||
`InternalDNS` and `Hostname` addresses keep the private DNS name (`ip-10-0-1-10.ec2.internal`). An image whose own
|
||||
kubelet registers the node keeps the name that kubelet gives it.
|
||||
- **Empty nodes.** A node that runs no workload (DaemonSet and static pods aside) and that no pending pod is counting
|
||||
on is removed once it has been empty for its pool's `disruption.consolidateAfter`, as Auto Mode's consolidation
|
||||
removes it: it is tainted `karpenter.sh/disrupted:NoSchedule`, as Karpenter marks a node it removes, and unless
|
||||
@@ -535,8 +538,8 @@ launches nodes on AWS. Floci checks every 10 seconds.
|
||||
cluster security group deleted next (one that doesn't fails the delete, which can be retried), and deletes the
|
||||
instance profiles made for it.
|
||||
|
||||
On AWS, a node is named after its instance ID and is a managed instance a plain `DescribeInstances` doesn't list.
|
||||
In Floci it is named as other joined instances are, after its private DNS name, and `DescribeInstances` lists it.
|
||||
On AWS, a node is a managed instance a plain `DescribeInstances` doesn't list; in Floci `DescribeInstances` lists it.
|
||||
An image whose own kubelet registers its node keeps the name that kubelet gives it, not the instance ID.
|
||||
Floci doesn't replace underutilized nodes with smaller ones, and a NodeClaim's requirements name only the instance
|
||||
type chosen, where AWS lists every type that would do.
|
||||
|
||||
|
||||
@@ -693,13 +693,32 @@ public class EksAutoModeCompute implements EksAutoModeCleanup {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether {@code node} is {@code instance}'s, by its provider ID ({@code aws:///<zone>/<instance>}, as a kubelet
|
||||
* and Floci's own Ready node set it); {@code false} for no node.
|
||||
*/
|
||||
private static boolean isNodeOf(JsonNode node, Instance instance) {
|
||||
return node != null && node.path("spec").path("providerID").asText("")
|
||||
.endsWith("/" + instance.getInstanceId());
|
||||
}
|
||||
|
||||
/** Adds {@code name} to {@code stray} when the node of that name is {@code instance}'s. */
|
||||
private static void addIfNodeOf(Set<String> stray, Map<String, JsonNode> nodesByName, String name,
|
||||
Instance instance) {
|
||||
if (name != null && isNodeOf(nodesByName.get(name), instance)) {
|
||||
stray.add(name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the nodes of the cluster's Auto Mode instances that are shutting down or terminated: one that
|
||||
* registered after a pass read the nodes, while that pass terminated its instance, or whose deletion failed
|
||||
* after it. Only a node named after such an instance and whose provider ID is that instance's is touched, and
|
||||
* not one a live Auto Mode instance's node shares the name of, so the cluster's own node and other workers stay
|
||||
* whatever their labels, a worker that joined later under the same name included. A pass retries
|
||||
* while EC2 keeps the terminated instance, an hour as on AWS.
|
||||
* while EC2 keeps the terminated instance, an hour as on AWS. A node left under an instance's private DNS name
|
||||
* from before Auto Mode nodes took their instance IDs, one a cluster kept from before this change has, is
|
||||
* deleted the same way, each pass until it is gone, whether the instance is live or terminated.
|
||||
*/
|
||||
private void removeStrayNodes(Cluster cluster, String region, Map<String, JsonNode> nodesByName) {
|
||||
if (nodesByName.isEmpty()) {
|
||||
@@ -707,19 +726,21 @@ public class EksAutoModeCompute implements EksAutoModeCleanup {
|
||||
}
|
||||
Set<String> stray = new LinkedHashSet<>();
|
||||
for (Instance instance : instancesOf(cluster, region, "shutting-down", "terminated")) {
|
||||
String name = clusterManager.deriveInstanceNodeName(instance, region);
|
||||
JsonNode node = nodesByName.get(name);
|
||||
// Only the node that is this instance's, by its provider ID (aws:///<zone>/<instance>, as a kubelet and
|
||||
// Floci's own Ready node set it): another worker may have joined since under the same name.
|
||||
if (node != null && node.path("spec").path("providerID").asText("")
|
||||
.endsWith("/" + instance.getInstanceId())) {
|
||||
stray.add(name);
|
||||
// Only a node that is this instance's: another worker may have joined since under the same name.
|
||||
addIfNodeOf(stray, nodesByName, clusterManager.deriveInstanceNodeName(instance, region), instance);
|
||||
addIfNodeOf(stray, nodesByName, clusterManager.deriveInstanceDnsName(instance, region), instance);
|
||||
}
|
||||
List<Instance> live = instancesOf(cluster, region, "pending", "running", "stopping", "stopped");
|
||||
for (Instance instance : live) {
|
||||
String legacy = clusterManager.deriveInstanceDnsName(instance, region);
|
||||
if (legacy != null && !legacy.equals(clusterManager.deriveInstanceNodeName(instance, region))) {
|
||||
addIfNodeOf(stray, nodesByName, legacy, instance);
|
||||
}
|
||||
}
|
||||
if (stray.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (Instance instance : instancesOf(cluster, region, "pending", "running", "stopping", "stopped")) {
|
||||
for (Instance instance : live) {
|
||||
stray.remove(clusterManager.deriveInstanceNodeName(instance, region));
|
||||
}
|
||||
for (String name : stray) {
|
||||
@@ -727,11 +748,11 @@ public class EksAutoModeCompute implements EksAutoModeCleanup {
|
||||
exec(cluster, List.of("kubectl", "delete", "node", name, "--ignore-not-found=true", "--wait=false"),
|
||||
"delete node " + name);
|
||||
nodesByName.remove(name);
|
||||
LOG.infov("EKS Auto Mode deleted node {0} of cluster {1}, whose instance is gone", name,
|
||||
LOG.infov("EKS Auto Mode deleted node {0} of cluster {1}, no live instance''s node", name,
|
||||
cluster.getName());
|
||||
} catch (RuntimeException e) {
|
||||
LOG.warnv("EKS Auto Mode node {0} of cluster {1}, whose instance is gone, wasn''t deleted: {2}", name,
|
||||
cluster.getName(), e.getMessage());
|
||||
LOG.warnv("EKS Auto Mode node {0} of cluster {1}, no live instance''s node, wasn''t deleted: {2}",
|
||||
name, cluster.getName(), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,7 +530,7 @@ public class EksClusterManager
|
||||
for (Map<String, Instance> map : joinedClusterInstances.values()) {
|
||||
for (Instance inst : map.values()) {
|
||||
if (inst != null && inst.getPrivateIpAddress() != null && !inst.getPrivateIpAddress().isBlank()) {
|
||||
String nodeName = deriveInstanceNodeName(inst, inst.getRegion()).toLowerCase(Locale.ROOT);
|
||||
String nodeName = deriveInstanceDnsName(inst, inst.getRegion()).toLowerCase(Locale.ROOT);
|
||||
if (name.equals(nodeName)) {
|
||||
return Optional.of(DnsAnswer.records(List.of(inst.getPrivateIpAddress()), DnsAnswer.DEFAULT_TTL_SECONDS));
|
||||
}
|
||||
@@ -563,7 +563,7 @@ public class EksClusterManager
|
||||
for (Map<String, Instance> map : joinedClusterInstances.values()) {
|
||||
for (Instance inst : map.values()) {
|
||||
if (inst != null && vpcId.equals(inst.getVpcId())) {
|
||||
rules.add(DnsForwardingRule.system(deriveInstanceNodeName(inst, inst.getRegion())));
|
||||
rules.add(DnsForwardingRule.system(deriveInstanceDnsName(inst, inst.getRegion())));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4270,7 +4270,20 @@ public class EksClusterManager
|
||||
return "aws:///" + az + "/" + (instance != null && instance.getInstanceId() != null ? instance.getInstanceId() : "i-00000000000000000");
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of an instance's node: an EKS Auto Mode instance's is its instance ID, as AWS names Auto Mode's nodes
|
||||
* ({@code i-0123456789abcdef0}); any other's, or one whose own kubelet registers its node, is its private DNS name.
|
||||
*/
|
||||
String deriveInstanceNodeName(Instance instance, String region) {
|
||||
if (autoModeInstance(instance) && instance.getInstanceId() != null
|
||||
&& (instance.getImageId() == null || !kubeletRegistersNode(instance))) {
|
||||
return instance.getInstanceId();
|
||||
}
|
||||
return deriveInstanceDnsName(instance, region);
|
||||
}
|
||||
|
||||
/** An instance's private DNS name, as its node's {@code Hostname} and {@code InternalDNS} addresses give it. */
|
||||
String deriveInstanceDnsName(Instance instance, String region) {
|
||||
if (instance != null && instance.getPrivateDnsName() != null && !instance.getPrivateDnsName().isBlank()) {
|
||||
return instance.getPrivateDnsName();
|
||||
}
|
||||
@@ -4437,6 +4450,13 @@ public class EksClusterManager
|
||||
}
|
||||
}
|
||||
|
||||
/** Whether EKS Auto Mode launched the instance, as its {@code aws:ec2:managed-launch} tag says. */
|
||||
static boolean autoModeInstance(Instance instance) {
|
||||
return instance != null && instance.getTags() != null && instance.getTags().stream().anyMatch(t ->
|
||||
EksAutoModeCompute.MANAGED_LAUNCH_TAG.equals(t.getKey())
|
||||
&& EksAutoModeCompute.MANAGED_LAUNCH.equals(t.getValue()));
|
||||
}
|
||||
|
||||
/** Whether the instance's image runs a kubelet that registers its node, rather than Floci registering it. */
|
||||
boolean kubeletRegistersNode(Instance instance) {
|
||||
return imageCatalog.findByIdOrAlias(instance.getImageId())
|
||||
@@ -4489,13 +4509,17 @@ public class EksClusterManager
|
||||
+ cluster.getName() + ": " + applyRes.stderr());
|
||||
}
|
||||
|
||||
// An Auto Mode node, named by its instance ID, keeps its private DNS name among its addresses, as on AWS.
|
||||
String dnsName = deriveInstanceDnsName(instance, region);
|
||||
String internalDns = autoModeInstance(instance)
|
||||
? "{\"type\":\"InternalDNS\",\"address\":\"" + dnsName + "\"}," : "";
|
||||
String statusPatch = String.format(Locale.ROOT,
|
||||
"{\"status\":{\"conditions\":[{\"type\":\"Ready\",\"status\":\"True\","
|
||||
+ "\"reason\":\"KubeletReady\",\"message\":\"kubelet is posting ready status\"}],"
|
||||
+ "\"addresses\":[{\"type\":\"InternalIP\",\"address\":\"%s\"},{\"type\":\"Hostname\",\"address\":\"%s\"}],"
|
||||
+ "\"addresses\":[{\"type\":\"InternalIP\",\"address\":\"%s\"},%s{\"type\":\"Hostname\",\"address\":\"%s\"}],"
|
||||
+ "\"capacity\":{\"cpu\":\"%s\",\"memory\":\"%s\",\"pods\":\"110\"},"
|
||||
+ "\"allocatable\":{\"cpu\":\"%s\",\"memory\":\"%s\",\"pods\":\"110\"}}}",
|
||||
privateIp, nodeName, cpu, memory, cpu, memory);
|
||||
privateIp, internalDns, dnsName, cpu, memory, cpu, memory);
|
||||
|
||||
ContainerExec.Result patchRes = execInContainerForResult(containerId,
|
||||
new String[]{"kubectl", "patch", "node", nodeName, "--subresource=status", "--type=merge",
|
||||
|
||||
@@ -313,6 +313,11 @@ class EksAutoModeComputeTest {
|
||||
&& cmd[cmd.length - 1].contains("\"type\":\"Launched\",\"status\":\"True\"")), anyInt());
|
||||
}
|
||||
|
||||
/** The command that deletes node {@code name}, as Auto Mode runs it. */
|
||||
private static String[] deleteNode(String name) {
|
||||
return new String[]{"kubectl", "delete", "node", name, "--ignore-not-found=true", "--wait=false"};
|
||||
}
|
||||
|
||||
/** A claim Auto Mode manages that is being deleted, held by Karpenter's finalizer. */
|
||||
private static String deletedClaim(String name) {
|
||||
return managedClaim(name, "").replace("\"metadata\": {",
|
||||
@@ -530,14 +535,40 @@ class EksAutoModeComputeTest {
|
||||
|
||||
compute.reconcile(cluster, REGION);
|
||||
|
||||
verify(clusterManager).execInContainerForResult("k3s-1", new String[]{"kubectl", "delete", "node", "stray",
|
||||
"--ignore-not-found=true", "--wait=false"}, 15);
|
||||
verify(clusterManager, never()).execInContainerForResult("k3s-1", new String[]{"kubectl", "delete", "node",
|
||||
"node-1", "--ignore-not-found=true", "--wait=false"}, 15);
|
||||
verify(clusterManager, never()).execInContainerForResult("k3s-1", new String[]{"kubectl", "delete", "node",
|
||||
"cluster-node", "--ignore-not-found=true", "--wait=false"}, 15);
|
||||
verify(clusterManager, never()).execInContainerForResult("k3s-1", new String[]{"kubectl", "delete", "node",
|
||||
"taken", "--ignore-not-found=true", "--wait=false"}, 15);
|
||||
verify(clusterManager).execInContainerForResult("k3s-1", deleteNode("stray"), 15);
|
||||
verify(clusterManager, never()).execInContainerForResult("k3s-1", deleteNode("node-1"), 15);
|
||||
verify(clusterManager, never()).execInContainerForResult("k3s-1", deleteNode("cluster-node"), 15);
|
||||
verify(clusterManager, never()).execInContainerForResult("k3s-1", deleteNode("taken"), 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* A live instance's node left under its private DNS name from before Auto Mode nodes took their instance IDs,
|
||||
* as a cluster kept from before this change has, goes on the next pass; its node under the instance ID stays, and
|
||||
* so does a node of that DNS name another instance's provider ID names.
|
||||
*/
|
||||
@Test
|
||||
void aLiveInstancesNodeLeftUnderItsDnsNameIsDeleted() {
|
||||
Instance live = joinedNode("i-node", "i-node");
|
||||
when(clusterManager.deriveInstanceDnsName(live, REGION)).thenReturn("ip-10-0-1-10.ec2.internal");
|
||||
lists.put("pods", "{\"items\": []}");
|
||||
lists.put("nodes", "{\"items\": ["
|
||||
+ "{\"metadata\": {\"name\": \"i-node\", \"labels\": {}}, "
|
||||
+ "\"spec\": {\"providerID\": \"aws:///us-east-1a/i-node\"}},"
|
||||
+ "{\"metadata\": {\"name\": \"ip-10-0-1-10.ec2.internal\", \"labels\": {}}, "
|
||||
+ "\"spec\": {\"providerID\": \"aws:///us-east-1a/i-node\"}}]}");
|
||||
lists.put("nodepools", POOLS.replace("\"spec\": {\"template\"",
|
||||
"\"spec\": {\"disruption\": {\"consolidateAfter\": \"Never\"}, \"template\""));
|
||||
|
||||
compute.reconcile(cluster("prod"), REGION);
|
||||
|
||||
verify(clusterManager).execInContainerForResult("k3s-1", deleteNode("ip-10-0-1-10.ec2.internal"), 15);
|
||||
verify(clusterManager, never()).execInContainerForResult("k3s-1", deleteNode("i-node"), 15);
|
||||
|
||||
// Another instance's worker under that name now: its provider ID isn't this instance's.
|
||||
lists.put("nodes", "{\"items\": [{\"metadata\": {\"name\": \"ip-10-0-1-10.ec2.internal\", \"labels\": {}}, "
|
||||
+ "\"spec\": {\"providerID\": \"aws:///us-east-1a/i-worker\"}}]}");
|
||||
compute.reconcile(cluster("prod"), REGION);
|
||||
verify(clusterManager, times(1)).execInContainerForResult("k3s-1", deleteNode("ip-10-0-1-10.ec2.internal"), 15);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -557,11 +588,31 @@ class EksAutoModeComputeTest {
|
||||
|
||||
compute.removeNodes(cluster, REGION);
|
||||
|
||||
verify(clusterManager).execInContainerForResult("k3s-1", new String[]{"kubectl", "delete", "node",
|
||||
"late-node", "--ignore-not-found=true", "--wait=false"}, 15);
|
||||
verify(clusterManager).execInContainerForResult("k3s-1", deleteNode("late-node"), 15);
|
||||
verify(ec2, never()).terminateInstances(anyString(), anyList());
|
||||
}
|
||||
|
||||
/**
|
||||
* A terminated instance's node left under its private DNS name, as when compute is turned off before a pass
|
||||
* after the upgrade has swept it, goes too.
|
||||
*/
|
||||
@Test
|
||||
void aTerminatedInstancesNodeLeftUnderItsDnsNameIsDeleted() {
|
||||
Instance ended = new Instance();
|
||||
ended.setInstanceId("i-old");
|
||||
when(clusterManager.deriveInstanceNodeName(ended, REGION)).thenReturn("i-old");
|
||||
when(clusterManager.deriveInstanceDnsName(ended, REGION)).thenReturn("ip-10-0-1-11.ec2.internal");
|
||||
instancesByState(List.of(), List.of(), List.of(ended));
|
||||
lists.put("nodes", "{\"items\": [{\"metadata\": {\"name\": \"ip-10-0-1-11.ec2.internal\", \"labels\": {}}, "
|
||||
+ "\"spec\": {\"providerID\": \"aws:///us-east-1a/i-old\"}}]}");
|
||||
Cluster cluster = cluster("prod");
|
||||
cluster.setComputeConfig(new ComputeConfig(false, List.of(), null));
|
||||
|
||||
compute.removeNodes(cluster, REGION);
|
||||
|
||||
verify(clusterManager).execInContainerForResult("k3s-1", deleteNode("ip-10-0-1-11.ec2.internal"), 15);
|
||||
}
|
||||
|
||||
/** A node whose kubelet runs keeps its pods' graceful shutdown: the drain gives them their grace period. */
|
||||
@Test
|
||||
void aKubeletsNodeIsDrainedWithItsPodsGracePeriod() {
|
||||
|
||||
+6
-3
@@ -174,11 +174,14 @@ class EksAutoModeNodesDockerNightlyIntegrationTest {
|
||||
// The pod is still unschedulable until the scheduler tries it again, but the joined node has room for it.
|
||||
assertEquals(1, RequestScopes.callAs(ACCOUNT, REGION, () -> compute.instancesOf(cluster, REGION, "pending", "running")).size());
|
||||
|
||||
// Named by its instance ID, as AWS names Auto Mode's nodes, with its hostname label the same.
|
||||
String nodeName = eksClusterManager.deriveInstanceNodeName(instance, REGION);
|
||||
assertEquals("general-purpose auto " + instance.getInstanceType(), node.kubectlOutput("get", "node", nodeName,
|
||||
"-o", "jsonpath={.metadata.labels.karpenter\\.sh/nodepool} "
|
||||
assertEquals(instance.getInstanceId(), nodeName);
|
||||
assertEquals("general-purpose auto " + instance.getInstanceType() + " " + nodeName, node.kubectlOutput("get",
|
||||
"node", nodeName, "-o", "jsonpath={.metadata.labels.karpenter\\.sh/nodepool} "
|
||||
+ "{.metadata.labels.eks\\.amazonaws\\.com/compute-type} "
|
||||
+ "{.metadata.labels.node\\.kubernetes\\.io/instance-type}"));
|
||||
+ "{.metadata.labels.node\\.kubernetes\\.io/instance-type} "
|
||||
+ "{.metadata.labels.kubernetes\\.io/hostname}"));
|
||||
await("the pod is scheduled on the new node").atMost(Duration.ofSeconds(60)).pollInterval(Duration.ofSeconds(2))
|
||||
.ignoreExceptions().until(() -> nodeName.equals(node.kubectlOutput("get", "pod", "web",
|
||||
"-o", "jsonpath={.spec.nodeName}")));
|
||||
|
||||
@@ -54,6 +54,7 @@ import io.floci.aws.services.ec2.model.Instance;
|
||||
import io.floci.aws.services.ec2.model.InstanceNetworkInterface;
|
||||
import io.floci.aws.services.ec2.model.LaunchTemplateData;
|
||||
import io.floci.aws.services.ec2.model.Placement;
|
||||
import io.floci.aws.services.ec2.model.Tag;
|
||||
import io.floci.aws.services.ec2.net.VpcNetworkManager;
|
||||
import io.floci.aws.services.ec2.portforward.Ec2PortForwardManager;
|
||||
import io.floci.aws.services.ecr.registry.EcrRegistryManager;
|
||||
@@ -5653,6 +5654,39 @@ class EksClusterManagerTest {
|
||||
assertTrue(patchCmd[7].contains("10.0.1.50") && patchCmd[7].contains("KubeletReady"));
|
||||
}
|
||||
|
||||
/**
|
||||
* As AWS names Auto Mode's nodes: by the instance ID, which the hostname label carries too, the private DNS
|
||||
* name kept as its InternalDNS and Hostname addresses and for DNS.
|
||||
*/
|
||||
@Test
|
||||
void anAutoModeInstancesNodeIsNamedByItsInstanceId() throws Exception {
|
||||
Cluster cluster = clusterNamed("auto-cluster", "auto-container");
|
||||
Instance inst = createInstance("i-0auto1234567890ab", "us-east-1a", "t3.medium", "x86_64", "10.0.1.80");
|
||||
inst.setPrivateDnsName("ip-10-0-1-80.ec2.internal");
|
||||
inst.setTags(List.of(new Tag(EksAutoModeCompute.MANAGED_LAUNCH_TAG, EksAutoModeCompute.MANAGED_LAUNCH)));
|
||||
ArgumentCaptor<String[]> commands = ArgumentCaptor.forClass(String[].class);
|
||||
doReturn(new ContainerExec.Result(0L, "", "", false)).when(manager)
|
||||
.execInContainerForResult(eq("auto-container"), commands.capture(), anyInt());
|
||||
|
||||
manager.joinInstance(cluster, inst);
|
||||
|
||||
assertEquals("i-0auto1234567890ab", manager.deriveInstanceNodeName(inst, "us-east-1"));
|
||||
assertEquals("ip-10-0-1-80.ec2.internal", manager.deriveInstanceDnsName(inst, "us-east-1"));
|
||||
String applyScript = commands.getAllValues().getFirst()[2];
|
||||
assertTrue(applyScript.contains("\"name\":\"i-0auto1234567890ab\""), applyScript);
|
||||
assertTrue(applyScript.contains("\"kubernetes.io/hostname\":\"i-0auto1234567890ab\""), applyScript);
|
||||
String[] patch = commands.getAllValues().get(1);
|
||||
assertEquals("i-0auto1234567890ab", patch[3]);
|
||||
assertTrue(patch[7].contains("{\"type\":\"InternalIP\",\"address\":\"10.0.1.80\"},"
|
||||
+ "{\"type\":\"InternalDNS\",\"address\":\"ip-10-0-1-80.ec2.internal\"},"
|
||||
+ "{\"type\":\"Hostname\",\"address\":\"ip-10-0-1-80.ec2.internal\"}"), patch[7]);
|
||||
assertEquals(Optional.of(List.of("10.0.1.80")), manager.resolveIpv4("ip-10-0-1-80.ec2.internal")
|
||||
.map(DnsAnswer::addresses));
|
||||
// Registration leaves any node under the private DNS name alone: Auto Mode's sweep removes this
|
||||
// instance's, by its provider ID.
|
||||
assertEquals(2, commands.getAllValues().size());
|
||||
}
|
||||
|
||||
/** As a kubelet does: the node registers with the labels and taints its NodeConfig's kubelet flags name. */
|
||||
@Test
|
||||
void aSyntheticNodeRegistersWithItsNodeConfigsLabelsAndTaints() {
|
||||
|
||||
Reference in new issue
Block a user