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
```
pull/6/head
Kubernetes Submit Queue 2017-05-08 15:46:39 -07:00 committed by GitHub
commit d092fc546b
1 changed files with 5 additions and 1 deletions

View File

@ -1073,7 +1073,11 @@ func describeContainerBasicInfo(container api.Container, status api.ContainerSta
if strings.Contains(portString, ",") {
w.Write(LEVEL_2, "Ports:\t%s\n", portString)
} else {
w.Write(LEVEL_2, "Port:\t%s\n", portString)
if len(portString) == 0 {
w.Write(LEVEL_2, "Port:\t<none>\n")
} else {
w.Write(LEVEL_2, "Port:\t%s\n", portString)
}
}
}