Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add filedselector for Event #17817

Merged
merged 1 commit into from
Dec 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/api/v1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ func addConversionFuncs() {
"involvedObject.resourceVersion",
"involvedObject.fieldPath",
"reason",
"source":
"source",
"type":
return label, value, nil
default:
return "", "", fmt.Errorf("field label not supported: %s", label)
Expand Down
1 change: 1 addition & 0 deletions pkg/client/unversioned/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ const (

EventReason = "reason"
EventSource = "source"
EventType = "type"
EventInvolvedKind = "involvedObject.kind"
EventInvolvedNamespace = "involvedObject.namespace"
EventInvolvedName = "involvedObject.name"
Expand Down
1 change: 1 addition & 0 deletions pkg/registry/event/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func getAttrs(obj runtime.Object) (objLabels labels.Set, objFields fields.Set, e
"involvedObject.fieldPath": event.InvolvedObject.FieldPath,
"reason": event.Reason,
"source": event.Source.Component,
"type": event.Type,
}
return l, generic.MergeFieldsSets(objectMetaFieldsSet, specificFieldsSet), nil
}
2 changes: 2 additions & 0 deletions pkg/registry/event/strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func TestGetAttrs(t *testing.T) {
},
Reason: "ForTesting",
Source: api.EventSource{Component: "test"},
Type: api.EventTypeNormal,
}
label, field, err := getAttrs(eventA)
if err != nil {
Expand All @@ -77,6 +78,7 @@ func TestGetAttrs(t *testing.T) {
"involvedObject.fieldPath": "",
"reason": "ForTesting",
"source": "test",
"type": api.EventTypeNormal,
}
if e, a := expect, field; !reflect.DeepEqual(e, a) {
t.Errorf("diff: %s", util.ObjectDiff(e, a))
Expand Down