mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #44316 from xiangpengzhao/print-node-addr
Automatic merge from submit-queue (batch tested with PRs 44440, 44038, 44302, 44316, 43876) Show node address type in kubectl describe node command **What this PR does / why we need it**: To make node addresses more clear when describing node. Before: ``` Addresses: 192.168.1.220,192.168.1.220,192.168.1.220 ``` After: ``` Addresses: LegacyHostIP: 192.168.1.220 InternalIP: 192.168.1.220 Hostname: 192.168.1.220 ``` **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note None ```
This commit is contained in:
commit
15a24eb056
@ -2070,9 +2070,10 @@ func describeNode(node *api.Node, nodeNonTerminatedPodsList *api.PodList, events
|
||||
c.Message)
|
||||
}
|
||||
}
|
||||
addresses := make([]string, 0, len(node.Status.Addresses))
|
||||
|
||||
w.Write(LEVEL_0, "Addresses:\n")
|
||||
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) {
|
||||
@ -2087,7 +2088,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 {
|
||||
w.Write(LEVEL_0, "Capacity:\n")
|
||||
printResourceList(node.Status.Capacity)
|
||||
|
Loading…
Reference in New Issue
Block a user