Show node address type in kubectl describe node command

This commit is contained in:
xiangpengzhao 2017-04-11 12:27:41 +08:00
parent 32600927d9
commit e1e1834e8b

View File

@ -2068,9 +2068,10 @@ func describeNode(node *api.Node, nodeNonTerminatedPodsList *api.PodList, events
c.Message) c.Message)
} }
} }
addresses := make([]string, 0, len(node.Status.Addresses))
w.Write(LEVEL_0, "Addresses:\n")
for _, address := range node.Status.Addresses { for _, address := range node.Status.Addresses {
addresses = append(addresses, address.Address) w.Write(LEVEL_1, "%s:\t%s\n", address.Type, address.Address)
} }
printResourceList := func(resourceList api.ResourceList) { printResourceList := func(resourceList api.ResourceList) {
@ -2085,7 +2086,6 @@ func describeNode(node *api.Node, nodeNonTerminatedPodsList *api.PodList, events
} }
} }
w.Write(LEVEL_0, "Addresses:\t%s\n", strings.Join(addresses, ","))
if len(node.Status.Capacity) > 0 { if len(node.Status.Capacity) > 0 {
w.Write(LEVEL_0, "Capacity:\n") w.Write(LEVEL_0, "Capacity:\n")
printResourceList(node.Status.Capacity) printResourceList(node.Status.Capacity)