Skip to content

Commit 1855901

Browse files
authored
Merge pull request kubernetes#82275 from mm4tt/ssh_private_nodes
Update NodeSSHHosts to support clusters with some public nodes
2 parents cedffee + 475a374 commit 1855901

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

test/e2e/framework/ssh/ssh.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,13 @@ func NodeSSHHosts(c clientset.Interface) ([]string, error) {
105105
nodelist := waitListSchedulableNodesOrDie(c)
106106

107107
hosts := nodeAddresses(nodelist, v1.NodeExternalIP)
108-
// If ExternalIPs aren't set, assume the test programs can reach the
109-
// InternalIP. Simplified exception logic here assumes that the hosts will
110-
// either all have ExternalIP or none will. Simplifies handling here and
111-
// should be adequate since the setting of the external IPs is provider
112-
// specific: they should either all have them or none of them will.
113-
if len(hosts) == 0 {
108+
// If ExternalIPs aren't available for all nodes, try falling back to the InternalIPs.
109+
if len(hosts) < len(nodelist.Items) {
114110
e2elog.Logf("No external IP address on nodes, falling back to internal IPs")
115111
hosts = nodeAddresses(nodelist, v1.NodeInternalIP)
116112
}
117113

118-
// Error if any node didn't have an external/internal IP.
114+
// Error if neither External nor Internal IPs weren't available for all nodes.
119115
if len(hosts) != len(nodelist.Items) {
120116
return hosts, fmt.Errorf(
121117
"only found %d IPs on nodes, but found %d nodes. Nodelist: %v",

0 commit comments

Comments
 (0)