Commit d092fc54 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #45474 from xiangpengzhao/fix-port-none

Automatic merge from submit-queue (batch tested with PRs 41903, 45311, 45474, 45472, 45501) Display <none> when port is empty. **What this PR does / why we need it**: If container ports are not specified, `kubectl describe` displays `<none>` instead of empty. **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 ```
parents 52903829 3e389566
...@@ -1073,8 +1073,12 @@ func describeContainerBasicInfo(container api.Container, status api.ContainerSta ...@@ -1073,8 +1073,12 @@ func describeContainerBasicInfo(container api.Container, status api.ContainerSta
if strings.Contains(portString, ",") { if strings.Contains(portString, ",") {
w.Write(LEVEL_2, "Ports:\t%s\n", portString) w.Write(LEVEL_2, "Ports:\t%s\n", portString)
} else { } else {
if len(portString) == 0 {
w.Write(LEVEL_2, "Port:\t<none>\n")
} else {
w.Write(LEVEL_2, "Port:\t%s\n", portString) w.Write(LEVEL_2, "Port:\t%s\n", portString)
} }
}
} }
func describeContainerPorts(cPorts []api.ContainerPort) string { func describeContainerPorts(cPorts []api.ContainerPort) string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment