mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #93687 from ingvagabund/oc-describe-pod-use-ReportingController-for-event-source
kubectl describe pod: use ReportingController as an event source
This commit is contained in:
commit
80c243382e
@ -3873,11 +3873,15 @@ func DescribeEvents(el *corev1.EventList, w PrefixWriter) {
|
|||||||
interval = translateMicroTimestampSince(e.EventTime)
|
interval = translateMicroTimestampSince(e.EventTime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
source := e.Source.Component
|
||||||
|
if source == "" {
|
||||||
|
source = e.ReportingController
|
||||||
|
}
|
||||||
w.Write(LEVEL_1, "%v\t%v\t%s\t%v\t%v\n",
|
w.Write(LEVEL_1, "%v\t%v\t%s\t%v\t%v\n",
|
||||||
e.Type,
|
e.Type,
|
||||||
e.Reason,
|
e.Reason,
|
||||||
interval,
|
interval,
|
||||||
formatEventSource(e.Source),
|
source,
|
||||||
strings.TrimSpace(e.Message),
|
strings.TrimSpace(e.Message),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -5001,15 +5005,6 @@ func translateTimestampSince(timestamp metav1.Time) string {
|
|||||||
return duration.HumanDuration(time.Since(timestamp.Time))
|
return duration.HumanDuration(time.Since(timestamp.Time))
|
||||||
}
|
}
|
||||||
|
|
||||||
// formatEventSource formats EventSource as a comma separated string excluding Host when empty
|
|
||||||
func formatEventSource(es corev1.EventSource) string {
|
|
||||||
EventSourceString := []string{es.Component}
|
|
||||||
if len(es.Host) > 0 {
|
|
||||||
EventSourceString = append(EventSourceString, es.Host)
|
|
||||||
}
|
|
||||||
return strings.Join(EventSourceString, ", ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pass ports=nil for all ports.
|
// Pass ports=nil for all ports.
|
||||||
func formatEndpoints(endpoints *corev1.Endpoints, ports sets.String) string {
|
func formatEndpoints(endpoints *corev1.Endpoints, ports sets.String) string {
|
||||||
if len(endpoints.Subsets) == 0 {
|
if len(endpoints.Subsets) == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user