mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 11:38:15 +00:00
add missing endpoints field label conversion function
This commit is contained in:
parent
66d2e1cb92
commit
aa9bdcbc4a
@ -141,6 +141,19 @@ func addConversionFuncs() {
|
|||||||
// If one of the conversion functions is malformed, detect it immediately.
|
// If one of the conversion functions is malformed, detect it immediately.
|
||||||
panic(err)
|
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 {
|
func convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(in *api.ReplicationControllerSpec, out *ReplicationControllerSpec, s conversion.Scope) error {
|
||||||
|
@ -153,6 +153,19 @@ func addConversionFuncs() {
|
|||||||
// If one of the conversion functions is malformed, detect it immediately.
|
// If one of the conversion functions is malformed, detect it immediately.
|
||||||
panic(err)
|
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 {
|
func convert_v1beta3_Container_To_api_Container(in *Container, out *api.Container, s conversion.Scope) error {
|
||||||
|
@ -376,11 +376,11 @@ func (s *Scheme) Convert(in, out interface{}) error {
|
|||||||
// versioned representation to an unversioned one.
|
// versioned representation to an unversioned one.
|
||||||
func (s *Scheme) ConvertFieldLabel(version, kind, label, value string) (string, string, error) {
|
func (s *Scheme) ConvertFieldLabel(version, kind, label, value string) (string, string, error) {
|
||||||
if s.fieldLabelConversionFuncs[version] == nil {
|
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]
|
conversionFunc, ok := s.fieldLabelConversionFuncs[version][kind]
|
||||||
if !ok {
|
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)
|
return conversionFunc(label, value)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user