Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'kubectl describe pv' now shows events #27431

Merged
merged 1 commit into from
Jun 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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