Skip to content

Commit

Permalink
Show events in 'kubectl describe pv'
Browse files Browse the repository at this point in the history
  • Loading branch information
jsafrane committed Jun 15, 2016
1 parent 3d09b99 commit e1e9a41
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/kubectl/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
})
}
Expand Down
9 changes: 9 additions & 0 deletions pkg/kubectl/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,15 @@ func TestDescribeEvents(t *testing.T) {
},
}, events),
},
"PersistentVolumeDescriber": &PersistentVolumeDescriber{
testclient.NewSimpleFake(&api.PersistentVolume{
ObjectMeta: api.ObjectMeta{
Name: "bar",
Namespace: "foo",
SelfLink: "url/url/url",
},
}, events),
},
"PodDescriber": &PodDescriber{
testclient.NewSimpleFake(&api.Pod{
ObjectMeta: api.ObjectMeta{
Expand Down

0 comments on commit e1e9a41

Please sign in to comment.