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:
@@ -141,11 +141,11 @@ func (d *NamespaceDescriber) Describe(namespace, name string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
resourceQuotaList, err := d.ResourceQuotas(name).List(labels.Everything(), fields.Everything(), unversioned.ListOptions{})
|
||||
resourceQuotaList, err := d.ResourceQuotas(name).List(unversioned.ListOptions{})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
limitRangeList, err := d.LimitRanges(name).List(labels.Everything(), fields.Everything(), unversioned.ListOptions{})
|
||||
limitRangeList, err := d.LimitRanges(name).List(unversioned.ListOptions{})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -422,10 +422,9 @@ func (d *PodDescriber) Describe(namespace, name string) (string, error) {
|
||||
pod, err := pc.Get(name)
|
||||
if err != nil {
|
||||
eventsInterface := d.Events(namespace)
|
||||
events, err2 := eventsInterface.List(
|
||||
labels.Everything(),
|
||||
eventsInterface.GetFieldSelector(&name, &namespace, nil, nil),
|
||||
unversioned.ListOptions{})
|
||||
selector := eventsInterface.GetFieldSelector(&name, &namespace, nil, nil)
|
||||
options := unversioned.ListOptions{FieldSelector: unversioned.FieldSelector{selector}}
|
||||
events, err2 := eventsInterface.List(options)
|
||||
if err2 == nil && len(events.Items) > 0 {
|
||||
return tabbedString(func(out io.Writer) error {
|
||||
fmt.Fprintf(out, "Pod '%v': error '%v', but found events.\n", name, err)
|
||||
@@ -1191,7 +1190,8 @@ func (d *ServiceAccountDescriber) Describe(namespace, name string) (string, erro
|
||||
tokens := []api.Secret{}
|
||||
|
||||
tokenSelector := fields.SelectorFromSet(map[string]string{client.SecretType: string(api.SecretTypeServiceAccountToken)})
|
||||
secrets, err := d.Secrets(namespace).List(labels.Everything(), tokenSelector, unversioned.ListOptions{})
|
||||
options := unversioned.ListOptions{FieldSelector: unversioned.FieldSelector{tokenSelector}}
|
||||
secrets, err := d.Secrets(namespace).List(options)
|
||||
if err == nil {
|
||||
for _, s := range secrets.Items {
|
||||
name, _ := s.Annotations[api.ServiceAccountNameKey]
|
||||
@@ -1268,7 +1268,7 @@ func (d *NodeDescriber) Describe(namespace, name string) (string, error) {
|
||||
}
|
||||
|
||||
var pods []*api.Pod
|
||||
allPods, err := d.Pods(namespace).List(labels.Everything(), fields.Everything(), unversioned.ListOptions{})
|
||||
allPods, err := d.Pods(namespace).List(unversioned.ListOptions{})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -1546,7 +1546,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(), fields.Everything(), unversioned.ListOptions{})
|
||||
dss, err := c.List(unversioned.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error getting daemon set: %v", err)
|
||||
}
|
||||
@@ -1573,7 +1573,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(), fields.Everything(), unversioned.ListOptions{})
|
||||
rcs, err := c.List(unversioned.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error getting replication controllers: %v", err)
|
||||
}
|
||||
@@ -1604,7 +1604,8 @@ func printReplicationControllersByLabels(matchingRCs []*api.ReplicationControlle
|
||||
}
|
||||
|
||||
func getPodStatusForController(c client.PodInterface, selector labels.Selector) (running, waiting, succeeded, failed int, err error) {
|
||||
rcPods, err := c.List(selector, fields.Everything(), unversioned.ListOptions{})
|
||||
options := unversioned.ListOptions{LabelSelector: unversioned.LabelSelector{selector}}
|
||||
rcPods, err := c.List(options)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user