Merge pull request #5200 from nikhiljindal/eventConverter

Adding conversion functions for event field selectors
This commit is contained in:
Brian Grant
2015-03-12 16:31:57 -07:00
4 changed files with 75 additions and 11 deletions

View File

@@ -1400,4 +1400,26 @@ func init() {
// If one of the conversion functions is malformed, detect it immediately.
panic(err)
}
err = newer.Scheme.AddFieldLabelConversionFunc("v1beta1", "events",
func(label, value string) (string, string, error) {
switch label {
case "involvedObject.kind",
"involvedObject.namespace",
"involvedObject.uid",
"involvedObject.apiVersion",
"involvedObject.resourceVersion",
"involvedObject.fieldPath",
"reason",
"source":
return label, value, nil
case "involvedObject.id":
return "involvedObject.name", value, nil
default:
return "", "", fmt.Errorf("field label not supported: %s", label)
}
})
if err != nil {
// If one of the conversion functions is malformed, detect it immediately.
panic(err)
}
}