Unify per-resource List for unversioned client

This commit is contained in:
Wojciech Tyczynski 2015-10-13 12:11:48 +02:00
parent dfb400e2e9
commit 647aa1bc8c
34 changed files with 73 additions and 67 deletions

View File

@ -527,7 +527,7 @@ func runSelfLinkTestOnNamespace(c *client.Client, namespace string) {
glog.Fatalf("Failed listing service with supplied self link '%v': %v", svc.SelfLink, err)
}
svcList, err := services.List(labels.Everything())
svcList, err := services.List(labels.Everything(), fields.Everything())
if err != nil {
glog.Fatalf("Failed listing services: %v", err)
}
@ -748,7 +748,7 @@ func runPatchTest(c *client.Client) {
func runMasterServiceTest(client *client.Client) {
time.Sleep(12 * time.Second)
svcList, err := client.Services(api.NamespaceDefault).List(labels.Everything())
svcList, err := client.Services(api.NamespaceDefault).List(labels.Everything(), fields.Everything())
if err != nil {
glog.Fatalf("Unexpected error listing services: %v", err)
}
@ -875,7 +875,7 @@ func runServiceTest(client *client.Client) {
glog.Fatalf("FAILED: service in other namespace should have no endpoints: %v", err)
}
svcList, err := client.Services(api.NamespaceAll).List(labels.Everything())
svcList, err := client.Services(api.NamespaceAll).List(labels.Everything(), fields.Everything())
if err != nil {
glog.Fatalf("Failed to list services across namespaces: %v", err)
}

View File

@ -58,7 +58,7 @@ func NewEndpointController(client *client.Client) *endpointController {
e.serviceStore.Store, e.serviceController = framework.NewInformer(
&cache.ListWatch{
ListFunc: func() (runtime.Object, error) {
return e.client.Services(api.NamespaceAll).List(labels.Everything())
return e.client.Services(api.NamespaceAll).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(rv string) (watch.Interface, error) {
return e.client.Services(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), rv)

View File

@ -29,7 +29,7 @@ type DaemonSetsNamespacer interface {
}
type DaemonSetInterface interface {
List(selector labels.Selector) (*extensions.DaemonSetList, error)
List(label labels.Selector, field fields.Selector) (*extensions.DaemonSetList, error)
Get(name string) (*extensions.DaemonSet, error)
Create(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error)
Update(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error)
@ -51,9 +51,9 @@ func newDaemonSets(c *ExtensionsClient, namespace string) *daemonSets {
// Ensure statically that daemonSets implements DaemonSetsInterface.
var _ DaemonSetInterface = &daemonSets{}
func (c *daemonSets) List(selector labels.Selector) (result *extensions.DaemonSetList, err error) {
func (c *daemonSets) List(label labels.Selector, field fields.Selector) (result *extensions.DaemonSetList, err error) {
result = &extensions.DaemonSetList{}
err = c.r.Get().Namespace(c.ns).Resource("daemonsets").LabelsSelectorParam(selector).Do().Into(result)
err = c.r.Get().Namespace(c.ns).Resource("daemonsets").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
return
}

View File

@ -22,6 +22,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
)
@ -55,7 +56,7 @@ func TestListDaemonSets(t *testing.T) {
},
},
}
receivedDSs, err := c.Setup(t).Extensions().DaemonSets(ns).List(labels.Everything())
receivedDSs, err := c.Setup(t).Extensions().DaemonSets(ns).List(labels.Everything(), fields.Everything())
c.Validate(t, receivedDSs, err)
}

View File

@ -32,7 +32,7 @@ type LimitRangesNamespacer interface {
// LimitRangeInterface has methods to work with LimitRange resources.
type LimitRangeInterface interface {
List(selector labels.Selector) (*api.LimitRangeList, error)
List(label labels.Selector, field fields.Selector) (*api.LimitRangeList, error)
Get(name string) (*api.LimitRange, error)
Delete(name string) error
Create(limitRange *api.LimitRange) (*api.LimitRange, error)
@ -55,9 +55,9 @@ func newLimitRanges(c *Client, namespace string) *limitRanges {
}
// List takes a selector, and returns the list of limitRanges that match that selector.
func (c *limitRanges) List(selector labels.Selector) (result *api.LimitRangeList, err error) {
func (c *limitRanges) List(label labels.Selector, field fields.Selector) (result *api.LimitRangeList, err error) {
result = &api.LimitRangeList{}
err = c.r.Get().Namespace(c.ns).Resource("limitRanges").LabelsSelectorParam(selector).Do().Into(result)
err = c.r.Get().Namespace(c.ns).Resource("limitRanges").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
return
}

View File

@ -122,7 +122,7 @@ func TestLimitRangeList(t *testing.T) {
},
Response: Response{StatusCode: 200, Body: limitRangeList},
}
response, err := c.Setup(t).LimitRanges(ns).List(labels.Everything())
response, err := c.Setup(t).LimitRanges(ns).List(labels.Everything(), fields.Everything())
c.Validate(t, response, err)
}

View File

@ -30,7 +30,7 @@ type ReplicationControllersNamespacer interface {
// ReplicationControllerInterface has methods to work with ReplicationController resources.
type ReplicationControllerInterface interface {
List(selector labels.Selector) (*api.ReplicationControllerList, error)
List(label labels.Selector, field fields.Selector) (*api.ReplicationControllerList, error)
Get(name string) (*api.ReplicationController, error)
Create(ctrl *api.ReplicationController) (*api.ReplicationController, error)
Update(ctrl *api.ReplicationController) (*api.ReplicationController, error)
@ -51,9 +51,9 @@ func newReplicationControllers(c *Client, namespace string) *replicationControll
}
// List takes a selector, and returns the list of replication controllers that match that selector.
func (c *replicationControllers) List(selector labels.Selector) (result *api.ReplicationControllerList, err error) {
func (c *replicationControllers) List(label labels.Selector, field fields.Selector) (result *api.ReplicationControllerList, err error) {
result = &api.ReplicationControllerList{}
err = c.r.Get().Namespace(c.ns).Resource("replicationControllers").LabelsSelectorParam(selector).Do().Into(result)
err = c.r.Get().Namespace(c.ns).Resource("replicationControllers").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
return
}

View File

@ -21,6 +21,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
)
@ -55,7 +56,7 @@ func TestListControllers(t *testing.T) {
},
},
}
receivedControllerList, err := c.Setup(t).ReplicationControllers(ns).List(labels.Everything())
receivedControllerList, err := c.Setup(t).ReplicationControllers(ns).List(labels.Everything(), fields.Everything())
c.Validate(t, receivedControllerList, err)
}

View File

@ -30,7 +30,7 @@ type ResourceQuotasNamespacer interface {
// ResourceQuotaInterface has methods to work with ResourceQuota resources.
type ResourceQuotaInterface interface {
List(selector labels.Selector) (*api.ResourceQuotaList, error)
List(label labels.Selector, field fields.Selector) (*api.ResourceQuotaList, error)
Get(name string) (*api.ResourceQuota, error)
Delete(name string) error
Create(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)
@ -54,9 +54,9 @@ func newResourceQuotas(c *Client, namespace string) *resourceQuotas {
}
// List takes a selector, and returns the list of resourceQuotas that match that selector.
func (c *resourceQuotas) List(selector labels.Selector) (result *api.ResourceQuotaList, err error) {
func (c *resourceQuotas) List(label labels.Selector, field fields.Selector) (result *api.ResourceQuotaList, err error) {
result = &api.ResourceQuotaList{}
err = c.r.Get().Namespace(c.ns).Resource("resourceQuotas").LabelsSelectorParam(selector).Do().Into(result)
err = c.r.Get().Namespace(c.ns).Resource("resourceQuotas").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
return
}

View File

@ -114,7 +114,7 @@ func TestResourceQuotaList(t *testing.T) {
},
Response: Response{StatusCode: 200, Body: resourceQuotaList},
}
response, err := c.Setup(t).ResourceQuotas(ns).List(labels.Everything())
response, err := c.Setup(t).ResourceQuotas(ns).List(labels.Everything(), fields.Everything())
c.Validate(t, response, err)
}

View File

@ -30,7 +30,7 @@ type ServicesNamespacer interface {
// ServiceInterface has methods to work with Service resources.
type ServiceInterface interface {
List(selector labels.Selector) (*api.ServiceList, error)
List(label labels.Selector, field fields.Selector) (*api.ServiceList, error)
Get(name string) (*api.Service, error)
Create(srv *api.Service) (*api.Service, error)
Update(srv *api.Service) (*api.Service, error)
@ -51,12 +51,13 @@ func newServices(c *Client, namespace string) *services {
}
// List takes a selector, and returns the list of services that match that selector
func (c *services) List(selector labels.Selector) (result *api.ServiceList, err error) {
func (c *services) List(label labels.Selector, field fields.Selector) (result *api.ServiceList, err error) {
result = &api.ServiceList{}
err = c.r.Get().
Namespace(c.ns).
Resource("services").
LabelsSelectorParam(selector).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Do().
Into(result)
return

View File

@ -23,6 +23,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
)
@ -54,7 +55,7 @@ func TestListServices(t *testing.T) {
},
},
}
receivedServiceList, err := c.Setup(t).Services(ns).List(labels.Everything())
receivedServiceList, err := c.Setup(t).Services(ns).List(labels.Everything(), fields.Everything())
t.Logf("received services: %v %#v", err, receivedServiceList)
c.Validate(t, receivedServiceList, err)
}
@ -91,7 +92,7 @@ func TestListServicesLabels(t *testing.T) {
c.Setup(t)
c.QueryValidator[labelSelectorQueryParamName] = validateLabels
selector := labels.Set{"foo": "bar", "name": "baz"}.AsSelector()
receivedServiceList, err := c.Services(ns).List(selector)
receivedServiceList, err := c.Services(ns).List(selector, fields.Everything())
c.Validate(t, receivedServiceList, err)
}

View File

@ -42,8 +42,8 @@ func (c *FakeDaemonSets) Get(name string) (*extensions.DaemonSet, error) {
return obj.(*extensions.DaemonSet), err
}
func (c *FakeDaemonSets) List(label labels.Selector) (*extensions.DaemonSetList, error) {
obj, err := c.Fake.Invokes(NewListAction("daemonsets", c.Namespace, label, nil), &extensions.DaemonSetList{})
func (c *FakeDaemonSets) List(label labels.Selector, field fields.Selector) (*extensions.DaemonSetList, error) {
obj, err := c.Fake.Invokes(NewListAction("daemonsets", c.Namespace, label, field), &extensions.DaemonSetList{})
if obj == nil {
return nil, err
}

View File

@ -39,8 +39,8 @@ func (c *FakeLimitRanges) Get(name string) (*api.LimitRange, error) {
return obj.(*api.LimitRange), err
}
func (c *FakeLimitRanges) List(label labels.Selector) (*api.LimitRangeList, error) {
obj, err := c.Fake.Invokes(NewListAction("limitranges", c.Namespace, label, nil), &api.LimitRangeList{})
func (c *FakeLimitRanges) List(label labels.Selector, field fields.Selector) (*api.LimitRangeList, error) {
obj, err := c.Fake.Invokes(NewListAction("limitranges", c.Namespace, label, field), &api.LimitRangeList{})
if obj == nil {
return nil, err
}

View File

@ -39,8 +39,8 @@ func (c *FakeReplicationControllers) Get(name string) (*api.ReplicationControlle
return obj.(*api.ReplicationController), err
}
func (c *FakeReplicationControllers) List(label labels.Selector) (*api.ReplicationControllerList, error) {
obj, err := c.Fake.Invokes(NewListAction("replicationcontrollers", c.Namespace, label, nil), &api.ReplicationControllerList{})
func (c *FakeReplicationControllers) List(label labels.Selector, field fields.Selector) (*api.ReplicationControllerList, error) {
obj, err := c.Fake.Invokes(NewListAction("replicationcontrollers", c.Namespace, label, field), &api.ReplicationControllerList{})
if obj == nil {
return nil, err
}

View File

@ -39,8 +39,8 @@ func (c *FakeResourceQuotas) Get(name string) (*api.ResourceQuota, error) {
return obj.(*api.ResourceQuota), err
}
func (c *FakeResourceQuotas) List(label labels.Selector) (*api.ResourceQuotaList, error) {
obj, err := c.Fake.Invokes(NewListAction("resourcequotas", c.Namespace, label, nil), &api.ResourceQuotaList{})
func (c *FakeResourceQuotas) List(label labels.Selector, field fields.Selector) (*api.ResourceQuotaList, error) {
obj, err := c.Fake.Invokes(NewListAction("resourcequotas", c.Namespace, label, field), &api.ResourceQuotaList{})
if obj == nil {
return nil, err
}

View File

@ -40,8 +40,8 @@ func (c *FakeServices) Get(name string) (*api.Service, error) {
return obj.(*api.Service), err
}
func (c *FakeServices) List(label labels.Selector) (*api.ServiceList, error) {
obj, err := c.Fake.Invokes(NewListAction("services", c.Namespace, label, nil), &api.ServiceList{})
func (c *FakeServices) List(label labels.Selector, field fields.Selector) (*api.ServiceList, error) {
obj, err := c.Fake.Invokes(NewListAction("services", c.Namespace, label, field), &api.ServiceList{})
if obj == nil {
return nil, err
}

View File

@ -22,6 +22,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
)
@ -33,7 +34,7 @@ func TestNewClient(t *testing.T) {
}
client := &Fake{}
client.AddReactor("*", "*", ObjectReaction(o, testapi.Default.RESTMapper()))
list, err := client.Services("test").List(labels.Everything())
list, err := client.Services("test").List(labels.Everything(), fields.Everything())
if err != nil {
t.Fatal(err)
}
@ -42,7 +43,7 @@ func TestNewClient(t *testing.T) {
}
// When list is invoked a second time, the same results are returned.
list, err = client.Services("test").List(labels.Everything())
list, err = client.Services("test").List(labels.Everything(), fields.Everything())
if err != nil {
t.Fatal(err)
}
@ -64,12 +65,12 @@ func TestErrors(t *testing.T) {
})
client := &Fake{}
client.AddReactor("*", "*", ObjectReaction(o, testapi.Default.RESTMapper()))
_, err := client.Services("test").List(labels.Everything())
_, err := client.Services("test").List(labels.Everything(), fields.Everything())
if !errors.IsNotFound(err) {
t.Fatalf("unexpected error: %v", err)
}
t.Logf("error: %#v", err.(*errors.StatusError).Status())
_, err = client.Services("test").List(labels.Everything())
_, err = client.Services("test").List(labels.Everything(), fields.Everything())
if !errors.IsForbidden(err) {
t.Fatalf("unexpected error: %v", err)
}

View File

@ -97,7 +97,7 @@ func NewDaemonSetsController(kubeClient client.Interface, resyncPeriod controlle
dsc.dsStore.Store, dsc.dsController = framework.NewInformer(
&cache.ListWatch{
ListFunc: func() (runtime.Object, error) {
return dsc.kubeClient.Extensions().DaemonSets(api.NamespaceAll).List(labels.Everything())
return dsc.kubeClient.Extensions().DaemonSets(api.NamespaceAll).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(rv string) (watch.Interface, error) {
return dsc.kubeClient.Extensions().DaemonSets(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), rv)

View File

@ -62,7 +62,7 @@ func NewEndpointController(client *client.Client, resyncPeriod controller.Resync
e.serviceStore.Store, e.serviceController = framework.NewInformer(
&cache.ListWatch{
ListFunc: func() (runtime.Object, error) {
return e.client.Services(api.NamespaceAll).List(labels.Everything())
return e.client.Services(api.NamespaceAll).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(rv string) (watch.Interface, error) {
return e.client.Services(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), rv)

View File

@ -306,7 +306,7 @@ func syncNamespace(kubeClient client.Interface, experimentalMode bool, namespace
}
func deleteLimitRanges(kubeClient client.Interface, ns string) error {
items, err := kubeClient.LimitRanges(ns).List(labels.Everything())
items, err := kubeClient.LimitRanges(ns).List(labels.Everything(), fields.Everything())
if err != nil {
return err
}
@ -320,7 +320,7 @@ func deleteLimitRanges(kubeClient client.Interface, ns string) error {
}
func deleteResourceQuotas(kubeClient client.Interface, ns string) error {
resourceQuotas, err := kubeClient.ResourceQuotas(ns).List(labels.Everything())
resourceQuotas, err := kubeClient.ResourceQuotas(ns).List(labels.Everything(), fields.Everything())
if err != nil {
return err
}
@ -348,7 +348,7 @@ func deleteServiceAccounts(kubeClient client.Interface, ns string) error {
}
func deleteServices(kubeClient client.Interface, ns string) error {
items, err := kubeClient.Services(ns).List(labels.Everything())
items, err := kubeClient.Services(ns).List(labels.Everything(), fields.Everything())
if err != nil {
return err
}
@ -362,7 +362,7 @@ func deleteServices(kubeClient client.Interface, ns string) error {
}
func deleteReplicationControllers(kubeClient client.Interface, ns string) error {
items, err := kubeClient.ReplicationControllers(ns).List(labels.Everything())
items, err := kubeClient.ReplicationControllers(ns).List(labels.Everything(), fields.Everything())
if err != nil {
return err
}
@ -461,7 +461,7 @@ func deleteHorizontalPodAutoscalers(expClient client.ExtensionsInterface, ns str
}
func deleteDaemonSets(expClient client.ExtensionsInterface, ns string) error {
items, err := expClient.DaemonSets(ns).List(labels.Everything())
items, err := expClient.DaemonSets(ns).List(labels.Everything(), fields.Everything())
if err != nil {
return err
}

View File

@ -108,7 +108,7 @@ func NewReplicationManager(kubeClient client.Interface, resyncPeriod controller.
rm.rcStore.Store, rm.rcController = framework.NewInformer(
&cache.ListWatch{
ListFunc: func() (runtime.Object, error) {
return rm.kubeClient.ReplicationControllers(api.NamespaceAll).List(labels.Everything())
return rm.kubeClient.ReplicationControllers(api.NamespaceAll).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(rv string) (watch.Interface, error) {
return rm.kubeClient.ReplicationControllers(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), rv)

View File

@ -58,7 +58,7 @@ func (rm *ResourceQuotaController) Run(period time.Duration) {
func (rm *ResourceQuotaController) synchronize() {
var resourceQuotas []api.ResourceQuota
list, err := rm.kubeClient.ResourceQuotas(api.NamespaceAll).List(labels.Everything())
list, err := rm.kubeClient.ResourceQuotas(api.NamespaceAll).List(labels.Everything(), fields.Everything())
if err != nil {
glog.Errorf("Synchronization error: %v (%#v)", err, err)
}
@ -165,19 +165,19 @@ func (rm *ResourceQuotaController) syncResourceQuota(quota api.ResourceQuota) (e
case api.ResourcePods:
value = resource.NewQuantity(int64(len(filteredPods)), resource.DecimalSI)
case api.ResourceServices:
items, err := rm.kubeClient.Services(usage.Namespace).List(labels.Everything())
items, err := rm.kubeClient.Services(usage.Namespace).List(labels.Everything(), fields.Everything())
if err != nil {
return err
}
value = resource.NewQuantity(int64(len(items.Items)), resource.DecimalSI)
case api.ResourceReplicationControllers:
items, err := rm.kubeClient.ReplicationControllers(usage.Namespace).List(labels.Everything())
items, err := rm.kubeClient.ReplicationControllers(usage.Namespace).List(labels.Everything(), fields.Everything())
if err != nil {
return err
}
value = resource.NewQuantity(int64(len(items.Items)), resource.DecimalSI)
case api.ResourceQuotas:
items, err := rm.kubeClient.ResourceQuotas(usage.Namespace).List(labels.Everything())
items, err := rm.kubeClient.ResourceQuotas(usage.Namespace).List(labels.Everything(), fields.Everything())
if err != nil {
return err
}

View File

@ -151,11 +151,11 @@ func (d *NamespaceDescriber) Describe(namespace, name string) (string, error) {
if err != nil {
return "", err
}
resourceQuotaList, err := d.ResourceQuotas(name).List(labels.Everything())
resourceQuotaList, err := d.ResourceQuotas(name).List(labels.Everything(), fields.Everything())
if err != nil {
return "", err
}
limitRangeList, err := d.LimitRanges(name).List(labels.Everything())
limitRangeList, err := d.LimitRanges(name).List(labels.Everything(), fields.Everything())
if err != nil {
return "", err
}
@ -1451,7 +1451,7 @@ func (dd *DeploymentDescriber) Describe(namespace, name string) (string, error)
func getDaemonSetsForLabels(c client.DaemonSetInterface, labelsToMatch labels.Labels) ([]extensions.DaemonSet, error) {
// Get all daemon sets
// TODO: this needs a namespace scope as argument
dss, err := c.List(labels.Everything())
dss, err := c.List(labels.Everything(), fields.Everything())
if err != nil {
return nil, fmt.Errorf("error getting daemon set: %v", err)
}
@ -1474,7 +1474,7 @@ func getDaemonSetsForLabels(c client.DaemonSetInterface, labelsToMatch labels.La
func getReplicationControllersForLabels(c client.ReplicationControllerInterface, labelsToMatch labels.Labels) ([]api.ReplicationController, error) {
// Get all replication controllers.
// TODO this needs a namespace scope as argument
rcs, err := c.List(labels.Everything())
rcs, err := c.List(labels.Everything(), fields.Everything())
if err != nil {
return nil, fmt.Errorf("error getting replication controllers: %v", err)
}

View File

@ -718,7 +718,7 @@ func updateWithRetries(rcClient client.ReplicationControllerInterface, rc *api.R
}
func FindSourceController(r client.ReplicationControllersNamespacer, namespace, name string) (*api.ReplicationController, error) {
list, err := r.ReplicationControllers(namespace).List(labels.Everything())
list, err := r.ReplicationControllers(namespace).List(labels.Everything(), fields.Everything())
if err != nil {
return nil, err
}

View File

@ -24,6 +24,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/meta"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/wait"
@ -100,7 +101,7 @@ type objInterface interface {
// getOverlappingControllers finds rcs that this controller overlaps, as well as rcs overlapping this controller.
func getOverlappingControllers(c client.ReplicationControllerInterface, rc *api.ReplicationController) ([]api.ReplicationController, error) {
rcs, err := c.List(labels.Everything())
rcs, err := c.List(labels.Everything(), fields.Everything())
if err != nil {
return nil, fmt.Errorf("error getting replication controllers: %v", err)
}

View File

@ -202,7 +202,7 @@ func NewMainKubelet(
// than an interface. There is no way to construct a list+watcher using resource name.
listWatch := &cache.ListWatch{
ListFunc: func() (runtime.Object, error) {
return kubeClient.Services(api.NamespaceAll).List(labels.Everything())
return kubeClient.Services(api.NamespaceAll).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(resourceVersion string) (watch.Interface, error) {
return kubeClient.Services(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), resourceVersion)

View File

@ -39,7 +39,7 @@ func GetOldRCs(deployment extensions.Deployment, c client.Interface) ([]*api.Rep
// 2. Find the corresponding RCs for pods in podList.
// TODO: Right now we list all RCs and then filter. We should add an API for this.
oldRCs := map[string]api.ReplicationController{}
rcList, err := c.ReplicationControllers(namespace).List(labels.Everything())
rcList, err := c.ReplicationControllers(namespace).List(labels.Everything(), fields.Everything())
if err != nil {
return nil, fmt.Errorf("error listing replication controllers: %v", err)
}
@ -67,7 +67,7 @@ func GetOldRCs(deployment extensions.Deployment, c client.Interface) ([]*api.Rep
// Returns nil if the new RC doesnt exist yet.
func GetNewRC(deployment extensions.Deployment, c client.Interface) (*api.ReplicationController, error) {
namespace := deployment.ObjectMeta.Namespace
rcList, err := c.ReplicationControllers(namespace).List(labels.Everything())
rcList, err := c.ReplicationControllers(namespace).List(labels.Everything(), fields.Everything())
if err != nil {
return nil, fmt.Errorf("error listing replication controllers: %v", err)
}

View File

@ -100,7 +100,7 @@ func (l *limitRanger) Admit(a admission.Attributes) (err error) {
func NewLimitRanger(client client.Interface, limitFunc LimitFunc) admission.Interface {
lw := &cache.ListWatch{
ListFunc: func() (runtime.Object, error) {
return client.LimitRanges(api.NamespaceAll).List(labels.Everything())
return client.LimitRanges(api.NamespaceAll).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(resourceVersion string) (watch.Interface, error) {
return client.LimitRanges(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), resourceVersion)

View File

@ -51,7 +51,7 @@ type quota struct {
func NewResourceQuota(client client.Interface) admission.Interface {
lw := &cache.ListWatch{
ListFunc: func() (runtime.Object, error) {
return client.ResourceQuotas(api.NamespaceAll).List(labels.Everything())
return client.ResourceQuotas(api.NamespaceAll).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(resourceVersion string) (watch.Interface, error) {
return client.ResourceQuotas(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), resourceVersion)

View File

@ -461,7 +461,7 @@ func runCmd(command string, args ...string) (string, string, error) {
func validate(f Framework, svcNameWant, rcNameWant string, ingress api.LoadBalancerIngress, podsWant int) error {
Logf("Beginning cluster validation")
// Verify RC.
rcs, err := f.Client.ReplicationControllers(f.Namespace.Name).List(labels.Everything())
rcs, err := f.Client.ReplicationControllers(f.Namespace.Name).List(labels.Everything(), fields.Everything())
if err != nil {
return fmt.Errorf("error listing RCs: %v", err)
}

View File

@ -882,7 +882,7 @@ func forEachReplicationController(c *client.Client, ns, selectorKey, selectorVal
var rcs *api.ReplicationControllerList
var err error
for t := time.Now(); time.Since(t) < podListTimeout; time.Sleep(poll) {
rcs, err = c.ReplicationControllers(ns).List(labels.SelectorFromSet(labels.Set(map[string]string{selectorKey: selectorValue})))
rcs, err = c.ReplicationControllers(ns).List(labels.SelectorFromSet(labels.Set(map[string]string{selectorKey: selectorValue})), fields.Everything())
Expect(err).NotTo(HaveOccurred())
if len(rcs.Items) > 0 {
break

View File

@ -78,7 +78,7 @@ func verifyExpectedRcsExistAndGetExpectedPods(c *client.Client) ([]string, error
// situaiton when a heapster-monitoring-v1 and heapster-monitoring-v2 replication controller
// is running (which would be an error except during a rolling update).
for _, rcLabel := range rcLabels {
rcList, err := c.ReplicationControllers(api.NamespaceSystem).List(labels.Set{"k8s-app": rcLabel}.AsSelector())
rcList, err := c.ReplicationControllers(api.NamespaceSystem).List(labels.Set{"k8s-app": rcLabel}.AsSelector(), fields.Everything())
if err != nil {
return nil, err
}
@ -103,7 +103,7 @@ func verifyExpectedRcsExistAndGetExpectedPods(c *client.Client) ([]string, error
}
func expectedServicesExist(c *client.Client) error {
serviceList, err := c.Services(api.NamespaceSystem).List(labels.Everything())
serviceList, err := c.Services(api.NamespaceSystem).List(labels.Everything(), fields.Everything())
if err != nil {
return err
}

View File

@ -340,7 +340,7 @@ func waitForPodsRunningReady(ns string, minPods int, timeout time.Duration) erro
// We get the new list of pods and replication controllers in every
// iteration because more pods come online during startup and we want to
// ensure they are also checked.
rcList, err := c.ReplicationControllers(ns).List(labels.Everything())
rcList, err := c.ReplicationControllers(ns).List(labels.Everything(), fields.Everything())
if err != nil {
Logf("Error getting replication controllers in namespace '%s': %v", ns, err)
return false, nil