Skip to content

Commit

Permalink
Merge pull request #3 from moadqassem/adjust-node-addresses-for-centos
Browse files Browse the repository at this point in the history
Add only the default interface and ip in the node status.
  • Loading branch information
moadqassem authored Mar 21, 2022
2 parents 79402e3 + 5135fd9 commit b282b96
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions pkg/cloudprovider/kubevirt/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,31 @@ func (i *instances) nodeAddressesByInstanceID(ctx context.Context, instanceID st
}

for _, netIface := range vmi.Status.Interfaces {
// TODO(dgonzalez): We currently assume that all IPs assigned to interfaces
// are internal IP addresses. In the future this function must be extended
// to detect the type of the address properly.
if netIface.IP != "" {
if netIface.IP != "" && netIface.Name == "default" {
v1helper.AddToNodeAddresses(&addresses, corev1.NodeAddress{
Type: corev1.NodeInternalIP,
Address: netIface.IP,
})
break
}
for _, ip := range netIface.IPs {
v1helper.AddToNodeAddresses(&addresses, corev1.NodeAddress{
Type: corev1.NodeInternalIP,
Address: ip,
})
}

// This snippet was commented due to the issue of kkp dnat-controller reported by this ticket:
// https://github.com/kubermatic/kubermatic/issues/9382.
// TODO(dgonzalez): We currently assume that all IPs assigned to interfaces
// are internal IP addresses. In the future this function must be extended
// to detect the type of the address properly.
//if netIface.IP != "" {
// v1helper.AddToNodeAddresses(&addresses, corev1.NodeAddress{
// Type: corev1.NodeInternalIP,
// Address: netIface.IP,
// })
//}
//for _, ip := range netIface.IPs {
// v1helper.AddToNodeAddresses(&addresses, corev1.NodeAddress{
// Type: corev1.NodeInternalIP,
// Address: ip,
// })
//}
}
return addresses, nil
}
Expand Down

0 comments on commit b282b96

Please sign in to comment.