mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Merge pull request #17817 from mqliang/eventtype
Auto commit by PR queue bot
This commit is contained in:
commit
c5924d20a5
@ -112,7 +112,8 @@ func addConversionFuncs() {
|
|||||||
"involvedObject.resourceVersion",
|
"involvedObject.resourceVersion",
|
||||||
"involvedObject.fieldPath",
|
"involvedObject.fieldPath",
|
||||||
"reason",
|
"reason",
|
||||||
"source":
|
"source",
|
||||||
|
"type":
|
||||||
return label, value, nil
|
return label, value, nil
|
||||||
default:
|
default:
|
||||||
return "", "", fmt.Errorf("field label not supported: %s", label)
|
return "", "", fmt.Errorf("field label not supported: %s", label)
|
||||||
|
@ -278,6 +278,7 @@ const (
|
|||||||
|
|
||||||
EventReason = "reason"
|
EventReason = "reason"
|
||||||
EventSource = "source"
|
EventSource = "source"
|
||||||
|
EventType = "type"
|
||||||
EventInvolvedKind = "involvedObject.kind"
|
EventInvolvedKind = "involvedObject.kind"
|
||||||
EventInvolvedNamespace = "involvedObject.namespace"
|
EventInvolvedNamespace = "involvedObject.namespace"
|
||||||
EventInvolvedName = "involvedObject.name"
|
EventInvolvedName = "involvedObject.name"
|
||||||
|
@ -95,6 +95,7 @@ func getAttrs(obj runtime.Object) (objLabels labels.Set, objFields fields.Set, e
|
|||||||
"involvedObject.fieldPath": event.InvolvedObject.FieldPath,
|
"involvedObject.fieldPath": event.InvolvedObject.FieldPath,
|
||||||
"reason": event.Reason,
|
"reason": event.Reason,
|
||||||
"source": event.Source.Component,
|
"source": event.Source.Component,
|
||||||
|
"type": event.Type,
|
||||||
}
|
}
|
||||||
return l, generic.MergeFieldsSets(objectMetaFieldsSet, specificFieldsSet), nil
|
return l, generic.MergeFieldsSets(objectMetaFieldsSet, specificFieldsSet), nil
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ func TestGetAttrs(t *testing.T) {
|
|||||||
},
|
},
|
||||||
Reason: "ForTesting",
|
Reason: "ForTesting",
|
||||||
Source: api.EventSource{Component: "test"},
|
Source: api.EventSource{Component: "test"},
|
||||||
|
Type: api.EventTypeNormal,
|
||||||
}
|
}
|
||||||
label, field, err := getAttrs(eventA)
|
label, field, err := getAttrs(eventA)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -77,6 +78,7 @@ func TestGetAttrs(t *testing.T) {
|
|||||||
"involvedObject.fieldPath": "",
|
"involvedObject.fieldPath": "",
|
||||||
"reason": "ForTesting",
|
"reason": "ForTesting",
|
||||||
"source": "test",
|
"source": "test",
|
||||||
|
"type": api.EventTypeNormal,
|
||||||
}
|
}
|
||||||
if e, a := expect, field; !reflect.DeepEqual(e, a) {
|
if e, a := expect, field; !reflect.DeepEqual(e, a) {
|
||||||
t.Errorf("diff: %s", util.ObjectDiff(e, a))
|
t.Errorf("diff: %s", util.ObjectDiff(e, a))
|
||||||
|
Loading…
Reference in New Issue
Block a user