예제 #1
0
func addConversionFuncs(scheme *runtime.Scheme) {
	if err := scheme.AddFieldLabelConversionFunc("v1", "ServiceBroker",
		oapi.GetFieldLabelConversionFunc(api.ServiceBrokerToSelectableFields(&api.ServiceBroker{}), nil),
	); err != nil {
		panic(err)
	}

}
예제 #2
0
func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
	return &generic.SelectionPredicate{
		Label: label,
		Field: field,
		GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
			sb, ok := obj.(*api.ServiceBroker)
			if !ok {
				return nil, nil, fmt.Errorf("not a servicebroker")
			}
			return labels.Set(sb.ObjectMeta.Labels), api.ServiceBrokerToSelectableFields(sb), nil
		},
	}
}
예제 #3
0
func getAttrs(obj runtime.Object) (objLabels labels.Set, objFields fields.Set, err error) {
	sb := obj.(*api.ServiceBroker)
	return labels.Set(sb.Labels), api.ServiceBrokerToSelectableFields(sb), nil
}