Skip to content

Commit

Permalink
UPSTREAM: 51035: Show events when describing service accounts
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Rogers <mrogers@redhat.com>

:100644 100644 0bf8233708... 38ce792d4b... M	pkg/printers/internalversion/describe.go
  • Loading branch information
Matt Rogers authored and deads2k committed Oct 5, 2017
1 parent e0acde8 commit 61d6108
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkg/printers/internalversion/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -2152,6 +2157,10 @@ func describeServiceAccount(serviceAccount *api.ServiceAccount, tokens []api.Sec
w.WriteLine()
}

if events != nil {
DescribeEvents(events, w)
}

return nil
})
}
Expand Down

0 comments on commit 61d6108

Please sign in to comment.