Commit f8aee185 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #50484 from sbezverk/ssh_local_ips

Automatic merge from submit-queue (batch tested with PRs 49904, 50484, 50214) Adding support for internal IP for e2e tests Currently IssueSSHComand in util.go only checks for External IP address to ssh, this PR adds check for internal IP too. Closes #50630
parents 533fba78 f41457c1
......@@ -3219,7 +3219,17 @@ func IssueSSHCommandWithResult(cmd, provider string, node *v1.Node) (*SSHResult,
}
if host == "" {
return nil, fmt.Errorf("couldn't find external IP address for node %s", node.Name)
// No external IPs were found, let's try to use internal as plan B
for _, a := range node.Status.Addresses {
if a.Type == v1.NodeInternalIP {
host = net.JoinHostPort(a.Address, sshPort)
break
}
}
}
if host == "" {
return nil, fmt.Errorf("couldn't find any IP address for node %s", node.Name)
}
Logf("SSH %q on %s(%s)", cmd, node.Name, host)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment