@@ -387,22 +387,22 @@ func nodeAddressForLB(node *corev1.Node, preferredIPFamily corev1.IPFamily) (str
387387 }
388388
389389 allowedAddrTypes := []corev1.NodeAddressType {corev1 .NodeInternalIP , corev1 .NodeExternalIP }
390- for _ , addr := range addrs {
391- if ! slices .Contains (allowedAddrTypes , addr .Type ) {
392- // Skip the address type that is not allowed
393- continue
394- }
395- switch preferredIPFamily {
396- case corev1 .IPv4Protocol :
397- if netutils .IsIPv4String (addr .Address ) {
398- return addr .Address , nil
399- }
400- case corev1 .IPv6Protocol :
401- if netutils .IsIPv6String (addr .Address ) {
402- return addr .Address , nil
390+ for _ , allowedAddrType := range allowedAddrTypes {
391+ for _ , addr := range addrs {
392+ if addr .Type == allowedAddrType {
393+ switch preferredIPFamily {
394+ case corev1 .IPv4Protocol :
395+ if netutils .IsIPv4String (addr .Address ) {
396+ return addr .Address , nil
397+ }
398+ case corev1 .IPv6Protocol :
399+ if netutils .IsIPv6String (addr .Address ) {
400+ return addr .Address , nil
401+ }
402+ default :
403+ return addr .Address , nil
404+ }
403405 }
404- default :
405- return addr .Address , nil
406406 }
407407 }
408408
0 commit comments