mirror of https://github.com/k3s-io/k3s
Merge pull request #73894 from smarterclayton/event_involved
Print the involved object in the event table as resource/namepull/564/head
commit
400502577c
|
@ -239,10 +239,10 @@ func AddHandlers(h printers.PrintHandler) {
|
||||||
{Name: "Last Seen", Type: "string", Description: apiv1.Event{}.SwaggerDoc()["lastTimestamp"]},
|
{Name: "Last Seen", Type: "string", Description: apiv1.Event{}.SwaggerDoc()["lastTimestamp"]},
|
||||||
{Name: "Type", Type: "string", Description: apiv1.Event{}.SwaggerDoc()["type"]},
|
{Name: "Type", Type: "string", Description: apiv1.Event{}.SwaggerDoc()["type"]},
|
||||||
{Name: "Reason", Type: "string", Description: apiv1.Event{}.SwaggerDoc()["reason"]},
|
{Name: "Reason", Type: "string", Description: apiv1.Event{}.SwaggerDoc()["reason"]},
|
||||||
{Name: "Kind", Type: "string", Description: apiv1.Event{}.InvolvedObject.SwaggerDoc()["kind"]},
|
{Name: "Object", Type: "string", Description: apiv1.Event{}.SwaggerDoc()["involvedObject"]},
|
||||||
|
{Name: "Subobject", Type: "string", Priority: 1, Description: apiv1.Event{}.InvolvedObject.SwaggerDoc()["fieldPath"]},
|
||||||
{Name: "Source", Type: "string", Priority: 1, Description: apiv1.Event{}.SwaggerDoc()["source"]},
|
{Name: "Source", Type: "string", Priority: 1, Description: apiv1.Event{}.SwaggerDoc()["source"]},
|
||||||
{Name: "Message", Type: "string", Description: apiv1.Event{}.SwaggerDoc()["message"]},
|
{Name: "Message", Type: "string", Description: apiv1.Event{}.SwaggerDoc()["message"]},
|
||||||
{Name: "Subobject", Type: "string", Priority: 1, Description: apiv1.Event{}.InvolvedObject.SwaggerDoc()["fieldPath"]},
|
|
||||||
{Name: "First Seen", Type: "string", Priority: 1, Description: apiv1.Event{}.SwaggerDoc()["firstTimestamp"]},
|
{Name: "First Seen", Type: "string", Priority: 1, Description: apiv1.Event{}.SwaggerDoc()["firstTimestamp"]},
|
||||||
{Name: "Count", Type: "string", Priority: 1, Description: apiv1.Event{}.SwaggerDoc()["count"]},
|
{Name: "Count", Type: "string", Priority: 1, Description: apiv1.Event{}.SwaggerDoc()["count"]},
|
||||||
{Name: "Name", Type: "string", Priority: 1, Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]},
|
{Name: "Name", Type: "string", Priority: 1, Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]},
|
||||||
|
@ -1385,15 +1385,21 @@ func printEvent(obj *api.Event, options printers.PrintOptions) ([]metav1beta1.Ta
|
||||||
firstTimestamp = translateTimestampSince(obj.FirstTimestamp)
|
firstTimestamp = translateTimestampSince(obj.FirstTimestamp)
|
||||||
lastTimestamp = translateTimestampSince(obj.LastTimestamp)
|
lastTimestamp = translateTimestampSince(obj.LastTimestamp)
|
||||||
}
|
}
|
||||||
|
var target string
|
||||||
|
if len(obj.InvolvedObject.Name) > 0 {
|
||||||
|
target = fmt.Sprintf("%s/%s", strings.ToLower(obj.InvolvedObject.Kind), obj.InvolvedObject.Name)
|
||||||
|
} else {
|
||||||
|
target = strings.ToLower(obj.InvolvedObject.Kind)
|
||||||
|
}
|
||||||
if options.Wide {
|
if options.Wide {
|
||||||
row.Cells = append(row.Cells,
|
row.Cells = append(row.Cells,
|
||||||
lastTimestamp,
|
lastTimestamp,
|
||||||
obj.Type,
|
obj.Type,
|
||||||
obj.Reason,
|
obj.Reason,
|
||||||
obj.InvolvedObject.Kind,
|
target,
|
||||||
|
obj.InvolvedObject.FieldPath,
|
||||||
formatEventSource(obj.Source),
|
formatEventSource(obj.Source),
|
||||||
strings.TrimSpace(obj.Message),
|
strings.TrimSpace(obj.Message),
|
||||||
obj.InvolvedObject.FieldPath,
|
|
||||||
firstTimestamp,
|
firstTimestamp,
|
||||||
int64(obj.Count),
|
int64(obj.Count),
|
||||||
obj.Name,
|
obj.Name,
|
||||||
|
@ -1403,7 +1409,7 @@ func printEvent(obj *api.Event, options printers.PrintOptions) ([]metav1beta1.Ta
|
||||||
lastTimestamp,
|
lastTimestamp,
|
||||||
obj.Type,
|
obj.Type,
|
||||||
obj.Reason,
|
obj.Reason,
|
||||||
obj.InvolvedObject.Kind,
|
target,
|
||||||
strings.TrimSpace(obj.Message),
|
strings.TrimSpace(obj.Message),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue