change field selector conversion registration to be strongly typed

Kubernetes-commit: f51ba20cddeb44be355a79718a8274c272efc1e4
This commit is contained in:
Jordan Liggitt 2018-07-03 15:47:20 -04:00 committed by Kubernetes Publisher
parent 55cfb76302
commit 453662ac63
3 changed files with 5 additions and 5 deletions

View File

@ -176,17 +176,17 @@ func init() {
addTestTypes()
addNewTestTypes()
scheme.AddFieldLabelConversionFunc(grouplessGroupVersion.String(), "Simple",
scheme.AddFieldLabelConversionFunc(grouplessGroupVersion.WithKind("Simple"),
func(label, value string) (string, string, error) {
return label, value, nil
},
)
scheme.AddFieldLabelConversionFunc(testGroupVersion.String(), "Simple",
scheme.AddFieldLabelConversionFunc(testGroupVersion.WithKind("Simple"),
func(label, value string) (string, string, error) {
return label, value, nil
},
)
scheme.AddFieldLabelConversionFunc(newGroupVersion.String(), "Simple",
scheme.AddFieldLabelConversionFunc(newGroupVersion.WithKind("Simple"),
func(label, value string) (string, string, error) {
return label, value, nil
},

View File

@ -224,7 +224,7 @@ func DeleteCollection(r rest.CollectionDeleter, checkBody bool, scope RequestSco
// TODO: DecodeParametersInto should do this.
if listOptions.FieldSelector != nil {
fn := func(label, value string) (newLabel, newValue string, err error) {
return scope.Convertor.ConvertFieldLabel(scope.Kind.GroupVersion().String(), scope.Kind.Kind, label, value)
return scope.Convertor.ConvertFieldLabel(scope.Kind, label, value)
}
if listOptions.FieldSelector, err = listOptions.FieldSelector.Transform(fn); err != nil {
// TODO: allow bad request to set field causes based on query parameters

View File

@ -196,7 +196,7 @@ func ListResource(r rest.Lister, rw rest.Watcher, scope RequestScope, forceWatch
// TODO: DecodeParametersInto should do this.
if opts.FieldSelector != nil {
fn := func(label, value string) (newLabel, newValue string, err error) {
return scope.Convertor.ConvertFieldLabel(scope.Kind.GroupVersion().String(), scope.Kind.Kind, label, value)
return scope.Convertor.ConvertFieldLabel(scope.Kind, label, value)
}
if opts.FieldSelector, err = opts.FieldSelector.Transform(fn); err != nil {
// TODO: allow bad request to set field causes based on query parameters