func init() { err := api.Scheme.AddDefaultingFuncs( func(obj *RouteSpec) { obj.To.Kind = "Service" }, func(obj *TLSConfig) { if len(obj.Termination) == 0 && len(obj.DestinationCACertificate) == 0 { obj.Termination = TLSTerminationEdge } switch obj.Termination { case TLSTerminationType("Reencrypt"): obj.Termination = TLSTerminationReencrypt case TLSTerminationType("Edge"): obj.Termination = TLSTerminationEdge case TLSTerminationType("Passthrough"): obj.Termination = TLSTerminationPassthrough } }, ) if err != nil { panic(err) } err = api.Scheme.AddConversionFuncs() if err != nil { panic(err) } if err := api.Scheme.AddFieldLabelConversionFunc("v1", "Route", oapi.GetFieldLabelConversionFunc(routeapi.RouteToSelectableFields(&routeapi.Route{}), nil), ); err != nil { panic(err) } }
func TestFieldSelectorConversions(t *testing.T) { testutil.CheckFieldLabelConversions(t, "v1", "Route", // Ensure all currently returned labels are supported api.RouteToSelectableFields(&api.Route{}), // Ensure previously supported labels have conversions. DO NOT REMOVE THINGS FROM THIS LIST "spec.host", "spec.path", "spec.to.name", ) }
func addConversionFuncs(scheme *runtime.Scheme) { if err := scheme.AddConversionFuncs(); err != nil { panic(err) } if err := scheme.AddFieldLabelConversionFunc("v1", "Route", oapi.GetFieldLabelConversionFunc(routeapi.RouteToSelectableFields(&routeapi.Route{}), nil), ); err != nil { panic(err) } }
func init() { err := api.Scheme.AddDefaultingFuncs( func(obj *RouteSpec) { obj.To.Kind = "Service" }, ) if err != nil { panic(err) } err = api.Scheme.AddConversionFuncs() if err != nil { panic(err) } if err := api.Scheme.AddFieldLabelConversionFunc("v1", "Route", oapi.GetFieldLabelConversionFunc(routeapi.RouteToSelectableFields(&routeapi.Route{}), nil), ); err != nil { panic(err) } }
func getAttrs(obj runtime.Object) (objLabels labels.Set, objFields fields.Set, err error) { route := obj.(*api.Route) return labels.Set(route.Labels), api.RouteToSelectableFields(route), nil }
func addConversionFuncs(scheme *runtime.Scheme) error { return scheme.AddFieldLabelConversionFunc("v1", "Route", oapi.GetFieldLabelConversionFunc(routeapi.RouteToSelectableFields(&routeapi.Route{}), nil), ) }