From aa9bdcbc4a1adf8d04e366b36b7507954136e78a Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Fri, 5 Jun 2015 17:09:23 -0700 Subject: [PATCH] add missing endpoints field label conversion function --- pkg/api/v1/conversion.go | 13 +++++++++++++ pkg/api/v1beta3/conversion.go | 13 +++++++++++++ pkg/runtime/scheme.go | 4 ++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/pkg/api/v1/conversion.go b/pkg/api/v1/conversion.go index 1549972a6e..4fb95230eb 100644 --- a/pkg/api/v1/conversion.go +++ b/pkg/api/v1/conversion.go @@ -141,6 +141,19 @@ func addConversionFuncs() { // If one of the conversion functions is malformed, detect it immediately. panic(err) } + err = api.Scheme.AddFieldLabelConversionFunc("v1beta3", "Endpoints", + func(label, value string) (string, string, error) { + switch label { + case "metadata.name": + return label, 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) + } } func convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(in *api.ReplicationControllerSpec, out *ReplicationControllerSpec, s conversion.Scope) error { diff --git a/pkg/api/v1beta3/conversion.go b/pkg/api/v1beta3/conversion.go index baa9d907f8..f0f779fed0 100644 --- a/pkg/api/v1beta3/conversion.go +++ b/pkg/api/v1beta3/conversion.go @@ -153,6 +153,19 @@ func addConversionFuncs() { // If one of the conversion functions is malformed, detect it immediately. panic(err) } + err = api.Scheme.AddFieldLabelConversionFunc("v1beta3", "Endpoints", + func(label, value string) (string, string, error) { + switch label { + case "metadata.name": + return label, 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) + } } func convert_v1beta3_Container_To_api_Container(in *Container, out *api.Container, s conversion.Scope) error { diff --git a/pkg/runtime/scheme.go b/pkg/runtime/scheme.go index a5c5b50b30..e05d827092 100644 --- a/pkg/runtime/scheme.go +++ b/pkg/runtime/scheme.go @@ -376,11 +376,11 @@ func (s *Scheme) Convert(in, out interface{}) error { // versioned representation to an unversioned one. func (s *Scheme) ConvertFieldLabel(version, kind, label, value string) (string, string, error) { if s.fieldLabelConversionFuncs[version] == nil { - return "", "", fmt.Errorf("No conversion function found for version: %s", version) + return "", "", fmt.Errorf("No field label conversion function found for version: %s", version) } conversionFunc, ok := s.fieldLabelConversionFuncs[version][kind] if !ok { - return "", "", fmt.Errorf("No conversion function found for version %s and kind %s", version, kind) + return "", "", fmt.Errorf("No field label conversion function found for version %s and kind %s", version, kind) } return conversionFunc(label, value) }