Skip to content

Commit 80c2433

Browse files
authored
Merge pull request kubernetes#93687 from ingvagabund/oc-describe-pod-use-ReportingController-for-event-source
kubectl describe pod: use ReportingController as an event source
2 parents f96deba + 71edf07 commit 80c2433

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

staging/src/k8s.io/kubectl/pkg/describe/describe.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3873,11 +3873,15 @@ func DescribeEvents(el *corev1.EventList, w PrefixWriter) {
38733873
interval = translateMicroTimestampSince(e.EventTime)
38743874
}
38753875
}
3876+
source := e.Source.Component
3877+
if source == "" {
3878+
source = e.ReportingController
3879+
}
38763880
w.Write(LEVEL_1, "%v\t%v\t%s\t%v\t%v\n",
38773881
e.Type,
38783882
e.Reason,
38793883
interval,
3880-
formatEventSource(e.Source),
3884+
source,
38813885
strings.TrimSpace(e.Message),
38823886
)
38833887
}
@@ -5001,15 +5005,6 @@ func translateTimestampSince(timestamp metav1.Time) string {
50015005
return duration.HumanDuration(time.Since(timestamp.Time))
50025006
}
50035007

5004-
// formatEventSource formats EventSource as a comma separated string excluding Host when empty
5005-
func formatEventSource(es corev1.EventSource) string {
5006-
EventSourceString := []string{es.Component}
5007-
if len(es.Host) > 0 {
5008-
EventSourceString = append(EventSourceString, es.Host)
5009-
}
5010-
return strings.Join(EventSourceString, ", ")
5011-
}
5012-
50135008
// Pass ports=nil for all ports.
50145009
func formatEndpoints(endpoints *corev1.Endpoints, ports sets.String) string {
50155010
if len(endpoints.Subsets) == 0 {

0 commit comments

Comments
 (0)