diff --git a/pkg/registry/certificates/strategy.go b/pkg/registry/certificates/strategy.go index 5c26aef339e..3928a4131b0 100644 --- a/pkg/registry/certificates/strategy.go +++ b/pkg/registry/certificates/strategy.go @@ -184,5 +184,5 @@ func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPre // SelectableFields returns a field set that can be used for filter selection func SelectableFields(obj *certificates.CertificateSigningRequest) fields.Set { - return fields.Set{} + return nil } diff --git a/pkg/registry/clusterrole/strategy.go b/pkg/registry/clusterrole/strategy.go index 556390d7af9..68950ea4555 100644 --- a/pkg/registry/clusterrole/strategy.go +++ b/pkg/registry/clusterrole/strategy.go @@ -118,5 +118,5 @@ func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPre // SelectableFields returns a field set that can be used for filter selection func SelectableFields(obj *rbac.ClusterRole) fields.Set { - return fields.Set{} + return nil } diff --git a/pkg/registry/clusterrolebinding/strategy.go b/pkg/registry/clusterrolebinding/strategy.go index 4ef043fe23d..102a8533ef7 100644 --- a/pkg/registry/clusterrolebinding/strategy.go +++ b/pkg/registry/clusterrolebinding/strategy.go @@ -118,5 +118,5 @@ func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPre // SelectableFields returns a field set that can be used for filter selection func SelectableFields(obj *rbac.ClusterRoleBinding) fields.Set { - return fields.Set{} + return nil } diff --git a/pkg/registry/generic/matcher.go b/pkg/registry/generic/matcher.go index c393dfca7af..61431fe1b6e 100644 --- a/pkg/registry/generic/matcher.go +++ b/pkg/registry/generic/matcher.go @@ -68,7 +68,11 @@ func (s *SelectionPredicate) Matches(obj runtime.Object) (bool, error) { if err != nil { return false, err } - return s.Label.Matches(labels) && s.Field.Matches(fields), nil + matched := s.Label.Matches(labels) + if s.Field != nil { + matched = (matched && s.Field.Matches(fields)) + } + return matched, nil } // MatchesSingle will return (name, true) if and only if s.Field matches on the object's diff --git a/pkg/registry/horizontalpodautoscaler/strategy.go b/pkg/registry/horizontalpodautoscaler/strategy.go index 12c0ecf0081..3ba063c0adf 100644 --- a/pkg/registry/horizontalpodautoscaler/strategy.go +++ b/pkg/registry/horizontalpodautoscaler/strategy.go @@ -85,7 +85,7 @@ func (autoscalerStrategy) AllowUnconditionalUpdate() bool { } func AutoscalerToSelectableFields(hpa *autoscaling.HorizontalPodAutoscaler) fields.Set { - return fields.Set{} + return nil } func MatchAutoscaler(label labels.Selector, field fields.Selector) *generic.SelectionPredicate { diff --git a/pkg/registry/limitrange/strategy.go b/pkg/registry/limitrange/strategy.go index 31af0fb2171..96fc19590da 100644 --- a/pkg/registry/limitrange/strategy.go +++ b/pkg/registry/limitrange/strategy.go @@ -75,7 +75,7 @@ func (limitrangeStrategy) AllowUnconditionalUpdate() bool { } func LimitRangeToSelectableFields(limitRange *api.LimitRange) fields.Set { - return fields.Set{} + return nil } func (limitrangeStrategy) Export(api.Context, runtime.Object, bool) error { diff --git a/pkg/registry/podtemplate/strategy.go b/pkg/registry/podtemplate/strategy.go index bfb7a0b86ee..4478928004e 100644 --- a/pkg/registry/podtemplate/strategy.go +++ b/pkg/registry/podtemplate/strategy.go @@ -83,7 +83,7 @@ func (podTemplateStrategy) Export(ctx api.Context, obj runtime.Object, exact boo } func PodTemplateToSelectableFields(podTemplate *api.PodTemplate) fields.Set { - return fields.Set{} + return nil } func MatchPodTemplate(label labels.Selector, field fields.Selector) *generic.SelectionPredicate { diff --git a/pkg/registry/role/strategy.go b/pkg/registry/role/strategy.go index fc38ba956b0..02d30e36a4d 100644 --- a/pkg/registry/role/strategy.go +++ b/pkg/registry/role/strategy.go @@ -118,5 +118,5 @@ func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPre // SelectableFields returns a field set that can be used for filter selection func SelectableFields(obj *rbac.Role) fields.Set { - return fields.Set{} + return nil } diff --git a/pkg/registry/rolebinding/strategy.go b/pkg/registry/rolebinding/strategy.go index 319f4f50ff9..2aca8190a23 100644 --- a/pkg/registry/rolebinding/strategy.go +++ b/pkg/registry/rolebinding/strategy.go @@ -118,5 +118,5 @@ func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPre // SelectableFields returns a field set that can be used for filter selection func SelectableFields(obj *rbac.RoleBinding) fields.Set { - return fields.Set{} + return nil } diff --git a/pkg/registry/thirdpartyresource/strategy.go b/pkg/registry/thirdpartyresource/strategy.go index daf1b70f048..39b20a874fa 100644 --- a/pkg/registry/thirdpartyresource/strategy.go +++ b/pkg/registry/thirdpartyresource/strategy.go @@ -94,5 +94,5 @@ func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPre // SelectableFields returns a field set that can be used for filter selection func SelectableFields(obj *extensions.ThirdPartyResource) fields.Set { - return fields.Set{} + return nil } diff --git a/pkg/registry/thirdpartyresourcedata/strategy.go b/pkg/registry/thirdpartyresourcedata/strategy.go index 12897519c59..5ed76ed45ac 100644 --- a/pkg/registry/thirdpartyresourcedata/strategy.go +++ b/pkg/registry/thirdpartyresourcedata/strategy.go @@ -91,5 +91,5 @@ func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPre // SelectableFields returns a field set that can be used for filter selection func SelectableFields(obj *extensions.ThirdPartyResourceData) fields.Set { - return fields.Set{} + return nil }