Пример #1
0
// Search returns a list of events matching the specified object.
func (c *FakeEvents) Search(objOrRef runtime.Object) (*v1.EventList, error) {
	action := testing.NewRootListAction(eventsResource, api.ListOptions{})
	if c.ns != "" {
		action = testing.NewListAction(eventsResource, c.ns, api.ListOptions{})
	}
	obj, err := c.Fake.Invokes(action, &v1.EventList{})
	if obj == nil {
		return nil, err
	}

	return obj.(*v1.EventList), err
}
Пример #2
0
func (c *FakePods) List(opts api.ListOptions) (result *v1.PodList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewListAction(podsResource, c.ns, opts), &v1.PodList{})

	if obj == nil {
		return nil, err
	}

	label := opts.LabelSelector
	if label == nil {
		label = labels.Everything()
	}
	list := &v1.PodList{}
	for _, item := range obj.(*v1.PodList).Items {
		if label.Matches(labels.Set(item.Labels)) {
			list.Items = append(list.Items, item)
		}
	}
	return list, err
}