mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #76637 from mm4tt/test_network
Add missing node.address != "" condition in tests
This commit is contained in:
commit
99e61466ab
@ -320,7 +320,7 @@ func (j *ServiceTestJig) CreateLoadBalancerService(namespace, serviceName string
|
|||||||
func GetNodeAddresses(node *v1.Node, addressType v1.NodeAddressType) (ips []string) {
|
func GetNodeAddresses(node *v1.Node, addressType v1.NodeAddressType) (ips []string) {
|
||||||
for j := range node.Status.Addresses {
|
for j := range node.Status.Addresses {
|
||||||
nodeAddress := &node.Status.Addresses[j]
|
nodeAddress := &node.Status.Addresses[j]
|
||||||
if nodeAddress.Type == addressType {
|
if nodeAddress.Type == addressType && nodeAddress.Address != "" {
|
||||||
ips = append(ips, nodeAddress.Address)
|
ips = append(ips, nodeAddress.Address)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ func IssueSSHCommandWithResult(cmd, provider string, node *v1.Node) (*SSHResult,
|
|||||||
Logf("Getting external IP address for %s", node.Name)
|
Logf("Getting external IP address for %s", node.Name)
|
||||||
host := ""
|
host := ""
|
||||||
for _, a := range node.Status.Addresses {
|
for _, a := range node.Status.Addresses {
|
||||||
if a.Type == v1.NodeExternalIP {
|
if a.Type == v1.NodeExternalIP && a.Address != "" {
|
||||||
host = net.JoinHostPort(a.Address, sshPort)
|
host = net.JoinHostPort(a.Address, sshPort)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ func IssueSSHCommandWithResult(cmd, provider string, node *v1.Node) (*SSHResult,
|
|||||||
if host == "" {
|
if host == "" {
|
||||||
// No external IPs were found, let's try to use internal as plan B
|
// No external IPs were found, let's try to use internal as plan B
|
||||||
for _, a := range node.Status.Addresses {
|
for _, a := range node.Status.Addresses {
|
||||||
if a.Type == v1.NodeInternalIP {
|
if a.Type == v1.NodeInternalIP && a.Address != "" {
|
||||||
host = net.JoinHostPort(a.Address, sshPort)
|
host = net.JoinHostPort(a.Address, sshPort)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -3424,7 +3424,7 @@ func NodeAddresses(nodelist *v1.NodeList, addrType v1.NodeAddressType) []string
|
|||||||
hosts := []string{}
|
hosts := []string{}
|
||||||
for _, n := range nodelist.Items {
|
for _, n := range nodelist.Items {
|
||||||
for _, addr := range n.Status.Addresses {
|
for _, addr := range n.Status.Addresses {
|
||||||
if addr.Type == addrType {
|
if addr.Type == addrType && addr.Address != "" {
|
||||||
hosts = append(hosts, addr.Address)
|
hosts = append(hosts, addr.Address)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -4942,7 +4942,7 @@ func GetNodeExternalIP(node *v1.Node) (string, error) {
|
|||||||
Logf("Getting external IP address for %s", node.Name)
|
Logf("Getting external IP address for %s", node.Name)
|
||||||
host := ""
|
host := ""
|
||||||
for _, a := range node.Status.Addresses {
|
for _, a := range node.Status.Addresses {
|
||||||
if a.Type == v1.NodeExternalIP {
|
if a.Type == v1.NodeExternalIP && a.Address != "" {
|
||||||
host = net.JoinHostPort(a.Address, sshPort)
|
host = net.JoinHostPort(a.Address, sshPort)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user