From 61d61088d03fb09c21a5d7c820f64add93c37ff2 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Fri, 11 Aug 2017 15:01:00 -0400 Subject: [PATCH] UPSTREAM: 51035: Show events when describing service accounts Signed-off-by: Matt Rogers :100644 100644 0bf8233708... 38ce792d4b... M pkg/printers/internalversion/describe.go --- pkg/printers/internalversion/describe.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/printers/internalversion/describe.go b/pkg/printers/internalversion/describe.go index 0bf8233708502..38ce792d4bffe 100644 --- a/pkg/printers/internalversion/describe.go +++ b/pkg/printers/internalversion/describe.go @@ -2097,10 +2097,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) @@ -2152,6 +2157,10 @@ func describeServiceAccount(serviceAccount *api.ServiceAccount, tokens []api.Sec w.WriteLine() } + if events != nil { + DescribeEvents(events, w) + } + return nil }) }