From 6ebabf319899cc0aaad39a252135bcf19b62948d Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 2 Mar 2026 12:08:56 -0500 Subject: [PATCH] Fix the semantics of e2essh.NodeSSHHosts on error If it failed to find an IP for every node, it returned a partial list along with an error. However, (a) this should never happen since every scheduleable node should have at least one usable IP, and (b) it didn't matter since all of its callers just treat any error as being fatal anyway. So just remove the special case. --- test/e2e/framework/ssh/ssh.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/e2e/framework/ssh/ssh.go b/test/e2e/framework/ssh/ssh.go index d60cec3c225..c9a136d8d7f 100644 --- a/test/e2e/framework/ssh/ssh.go +++ b/test/e2e/framework/ssh/ssh.go @@ -125,8 +125,7 @@ func makePrivateKeySignerFromFile(key string) (ssh.Signer, error) { // NodeSSHHosts returns SSH-able host names for all schedulable nodes. // If it can't find any external IPs, it falls back to // looking for internal IPs. If it can't find an internal IP for every node it -// returns an error, though it still returns all hosts that it found in that -// case. +// returns an error. func NodeSSHHosts(ctx context.Context, c clientset.Interface) ([]string, error) { nodelist := waitListSchedulableNodesOrDie(ctx, c) @@ -136,10 +135,9 @@ func NodeSSHHosts(ctx context.Context, c clientset.Interface) ([]string, error) framework.Logf("No external IP address on nodes, falling back to internal IPs") hosts = nodeAddresses(nodelist, v1.NodeInternalIP) } - - // Error if neither External nor Internal IPs weren't available for all nodes. if len(hosts) != len(nodelist.Items) { - return hosts, fmt.Errorf( + // Something is wrong; all schedulable nodes should have at least one IP. + return nil, fmt.Errorf( "only found %d IPs on nodes, but found %d nodes. Nodelist: %v", len(hosts), len(nodelist.Items), nodelist) }