print HostPathType for kubectl describe

This commit is contained in:
Di Xu 2017-09-13 11:14:32 +08:00
parent 01a4a600ac
commit f8211adf42
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) { 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"+ 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) { func printEmptyDirVolumeSource(emptyDir *api.EmptyDirVolumeSource, w PrefixWriter) {

View File

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