mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
Add 'source' to events field selector.
This commit is contained in:
parent
d6d6229fea
commit
f1b0b64a75
@ -88,8 +88,10 @@ func (rs *REST) getAttrs(obj runtime.Object) (objLabels, objFields labels.Set, e
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("invalid object type")
|
||||
}
|
||||
// TODO: internal version leaks through here. This should be versioned.
|
||||
return labels.Set{}, labels.Set{
|
||||
"involvedObject.kind": event.InvolvedObject.Kind,
|
||||
"involvedObject.namespace": event.InvolvedObject.Namespace,
|
||||
"involvedObject.name": event.InvolvedObject.Name,
|
||||
"involvedObject.uid": event.InvolvedObject.UID,
|
||||
"involvedObject.apiVersion": event.InvolvedObject.APIVersion,
|
||||
@ -97,6 +99,7 @@ func (rs *REST) getAttrs(obj runtime.Object) (objLabels, objFields labels.Set, e
|
||||
"involvedObject.fieldPath": event.InvolvedObject.FieldPath,
|
||||
"status": event.Status,
|
||||
"reason": event.Reason,
|
||||
"source": event.Source,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,7 @@ func TestRESTgetAttrs(t *testing.T) {
|
||||
InvolvedObject: api.ObjectReference{
|
||||
Kind: "Pod",
|
||||
Name: "foo",
|
||||
Namespace: "baz",
|
||||
UID: "long uid string",
|
||||
APIVersion: testapi.Version(),
|
||||
ResourceVersion: "0",
|
||||
@ -105,6 +106,7 @@ func TestRESTgetAttrs(t *testing.T) {
|
||||
},
|
||||
Status: "tested",
|
||||
Reason: "forTesting",
|
||||
Source: "test",
|
||||
}
|
||||
label, field, err := rest.getAttrs(eventA)
|
||||
if err != nil {
|
||||
@ -116,12 +118,14 @@ func TestRESTgetAttrs(t *testing.T) {
|
||||
expect := labels.Set{
|
||||
"involvedObject.kind": "Pod",
|
||||
"involvedObject.name": "foo",
|
||||
"involvedObject.namespace": "baz",
|
||||
"involvedObject.uid": "long uid string",
|
||||
"involvedObject.apiVersion": testapi.Version(),
|
||||
"involvedObject.resourceVersion": "0",
|
||||
"involvedObject.fieldPath": "",
|
||||
"status": "tested",
|
||||
"reason": "forTesting",
|
||||
"source": "test",
|
||||
}
|
||||
if e, a := expect, field; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("diff: %s", util.ObjectDiff(e, a))
|
||||
|
Loading…
Reference in New Issue
Block a user