Merge pull request #52379 from dixudx/kubectl_describe_hostpathtype

Automatic merge from submit-queue (batch tested with PRs 50294, 50422, 51757, 52379, 52014). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>..

print HostPathType for kubectl describe

**What this PR does / why we need it**:
Since #46597 has already added `HostPathType` for `HostPath`, we should print it when we describe it.

**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**:
@thockin PTAL
/assign @smarterclayton @liggitt @pwittrock

**Release note**:

```release-note
None
```
This commit is contained in:
Kubernetes Submit Queue
2017-09-23 11:40:53 -07:00
committed by GitHub
2 changed files with 8 additions and 2 deletions

View File

@@ -770,8 +770,14 @@ func describeVolumes(volumes []api.Volume, w PrefixWriter, space string) {
}
func printHostPathVolumeSource(hostPath *api.HostPathVolumeSource, w PrefixWriter) {
hostPathType := "<none>"
if hostPath.Type != nil {
hostPathType = string(*hostPath.Type)
}
w.Write(LEVEL_2, "Type:\tHostPath (bare host directory volume)\n"+
" Path:\t%v\n", hostPath.Path)
" Path:\t%v\n"+
" HostPathType:\t%v\n",
hostPath.Path, hostPathType)
}
func printEmptyDirVolumeSource(emptyDir *api.EmptyDirVolumeSource, w PrefixWriter) {

View File

@@ -664,7 +664,7 @@ func TestPersistentVolumeDescriber(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "bar"},
Spec: api.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{
HostPath: &api.HostPathVolumeSource{},
HostPath: &api.HostPathVolumeSource{Type: new(api.HostPathType)},
},
},
},