Show events in 'kubectl describe pv'

This commit is contained in:
Jan Safranek
2016-06-15 14:17:02 +02:00
parent 3d09b99d2c
commit e1e9a41757
2 changed files with 18 additions and 0 deletions

View File

@@ -724,6 +724,11 @@ func (d *PersistentVolumeDescriber) Describe(namespace, name string, describerSe
storage := pv.Spec.Capacity[api.ResourceStorage]
var events *api.EventList
if describerSettings.ShowEvents {
events, _ = d.Events(namespace).Search(pv)
}
return tabbedString(func(out io.Writer) error {
fmt.Fprintf(out, "Name:\t%s\n", pv.Name)
printLabelsMultiline(out, "Labels", pv.Labels)
@@ -756,6 +761,10 @@ func (d *PersistentVolumeDescriber) Describe(namespace, name string, describerSe
printRBDVolumeSource(pv.Spec.RBD, out)
}
if events != nil {
DescribeEvents(events, out)
}
return nil
})
}