Simplify List() signature in clients.

This commit is contained in:
Wojciech Tyczynski
2015-12-02 12:12:57 +01:00
parent 800012dfb8
commit 6dcb689d4e
141 changed files with 532 additions and 650 deletions

View File

@@ -29,7 +29,6 @@ import (
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/util/intstr"
"k8s.io/kubernetes/pkg/util/wait"
@@ -364,7 +363,8 @@ func (r *RollingUpdater) pollForReadyPods(interval, timeout time.Duration, oldRc
anyReady := false
for _, controller := range controllers {
selector := labels.Set(controller.Spec.Selector).AsSelector()
pods, err := r.c.Pods(controller.Namespace).List(selector, fields.Everything(), unversioned.ListOptions{})
options := unversioned.ListOptions{LabelSelector: unversioned.LabelSelector{selector}}
pods, err := r.c.Pods(controller.Namespace).List(options)
if err != nil {
return false, err
}
@@ -628,7 +628,9 @@ func AddDeploymentKeyToReplicationController(oldRc *api.ReplicationController, c
// Update all pods managed by the rc to have the new hash label, so they are correctly adopted
// TODO: extract the code from the label command and re-use it here.
podList, err := client.Pods(namespace).List(labels.SelectorFromSet(oldRc.Spec.Selector), fields.Everything(), unversioned.ListOptions{})
selector := labels.SelectorFromSet(oldRc.Spec.Selector)
options := unversioned.ListOptions{LabelSelector: unversioned.LabelSelector{selector}}
podList, err := client.Pods(namespace).List(options)
if err != nil {
return nil, err
}
@@ -678,7 +680,9 @@ func AddDeploymentKeyToReplicationController(oldRc *api.ReplicationController, c
// Clean up any orphaned pods that don't have the new label, this can happen if the rc manager
// doesn't see the update to its pod template and creates a new pod with the old labels after
// we've finished re-adopting existing pods to the rc.
podList, err = client.Pods(namespace).List(labels.SelectorFromSet(selectorCopy), fields.Everything(), unversioned.ListOptions{})
selector = labels.SelectorFromSet(selectorCopy)
options = unversioned.ListOptions{LabelSelector: unversioned.LabelSelector{selector}}
podList, err = client.Pods(namespace).List(options)
for ix := range podList.Items {
pod := &podList.Items[ix]
if value, found := pod.Labels[deploymentKey]; !found || value != deploymentValue {
@@ -719,7 +723,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(), fields.Everything(), unversioned.ListOptions{})
list, err := r.ReplicationControllers(namespace).List(unversioned.ListOptions{})
if err != nil {
return nil, err
}