Show events when describing service accounts

Signed-off-by: Matt Rogers <mrogers@redhat.com>
pull/6/head
Matt Rogers 2017-08-21 13:54:12 -04:00
parent baf2f85e73
commit c42c43a13f
1 changed files with 11 additions and 2 deletions

View File

@ -2173,10 +2173,15 @@ func (d *ServiceAccountDescriber) Describe(namespace, name string, describerSett
}
}
return describeServiceAccount(serviceAccount, tokens, missingSecrets)
var events *api.EventList
if describerSettings.ShowEvents {
events, _ = d.Core().Events(namespace).Search(api.Scheme, serviceAccount)
}
return describeServiceAccount(serviceAccount, tokens, missingSecrets, events)
}
func describeServiceAccount(serviceAccount *api.ServiceAccount, tokens []api.Secret, missingSecrets sets.String) (string, error) {
func describeServiceAccount(serviceAccount *api.ServiceAccount, tokens []api.Secret, missingSecrets sets.String, events *api.EventList) (string, error) {
return tabbedString(func(out io.Writer) error {
w := NewPrefixWriter(out)
w.Write(LEVEL_0, "Name:\t%s\n", serviceAccount.Name)
@ -2228,6 +2233,10 @@ func describeServiceAccount(serviceAccount *api.ServiceAccount, tokens []api.Sec
w.WriteLine()
}
if events != nil {
DescribeEvents(events, w)
}
return nil
})
}