mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 06:02:18 +00:00
Add field selector to List, implement for pods.
This commit is contained in:
@@ -43,9 +43,9 @@ func (rs *REST) Get(id string) (runtime.Object, error) {
|
||||
}
|
||||
|
||||
// List satisfies the RESTStorage interface.
|
||||
func (rs *REST) List(selector labels.Selector) (runtime.Object, error) {
|
||||
if !selector.Empty() {
|
||||
return nil, errors.New("label selectors are not supported on endpoints")
|
||||
func (rs *REST) List(label, field labels.Selector) (runtime.Object, error) {
|
||||
if !label.Empty() || !field.Empty() {
|
||||
return nil, errors.New("label/field selectors are not supported on endpoints")
|
||||
}
|
||||
return rs.registry.ListEndpoints()
|
||||
}
|
||||
|
@@ -79,7 +79,7 @@ func TestEndpointsRegistryList(t *testing.T) {
|
||||
{JSONBase: api.JSONBase{ID: "bar"}},
|
||||
},
|
||||
}
|
||||
s, _ := storage.List(labels.Everything())
|
||||
s, _ := storage.List(labels.Everything(), labels.Everything())
|
||||
sl := s.(*api.EndpointsList)
|
||||
if len(sl.Items) != 2 {
|
||||
t.Fatalf("Expected 2 endpoints, but got %v", len(sl.Items))
|
||||
|
Reference in New Issue
Block a user