mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Simplify List() signature in clients.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user