diff --git a/object/machine.go b/object/machine.go index c5dc6c6..de23bca 100644 --- a/object/machine.go +++ b/object/machine.go @@ -9,6 +9,7 @@ import ( type Machine struct { Version string MachineIP string + MachineName string Name string Namespace string ClusterName string @@ -33,8 +34,13 @@ func ToMachine(obj interface{}) interface{} { ClusterName: machine.ObjectMeta.GetClusterName(), } - if len(machine.Status.Addresses) > 0 { - m.MachineIP = machine.Status.Addresses[0].Address + for _, addr := range machine.Status.Addresses { + if addr.Type == "InternalIP" { + m.MachineIP = addr.Address + } + if addr.Type == "Hostname" { + m.MachineName = addr.Address + } } t := machine.ObjectMeta.DeletionTimestamp