Use unversioned.ListOptions in API server.

This commit is contained in:
Wojciech Tyczynski
2015-11-16 14:59:01 +01:00
parent a5f9a759d9
commit bf13bef955
24 changed files with 178 additions and 135 deletions

View File

@@ -22,6 +22,7 @@ import (
"net/url"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/watch"
)
@@ -60,7 +61,7 @@ type Lister interface {
// This object must be a pointer type for use with Codec.DecodeInto([]byte, runtime.Object)
NewList() runtime.Object
// List selects resources in the storage which match to the selector. 'options' can be nil.
List(ctx api.Context, options *api.ListOptions) (runtime.Object, error)
List(ctx api.Context, options *unversioned.ListOptions) (runtime.Object, error)
}
// Getter is an object that can retrieve a named RESTful resource.
@@ -181,7 +182,7 @@ type Watcher interface {
// are supported; an error should be returned if 'field' tries to select on a field that
// isn't supported. 'resourceVersion' allows for continuing/starting a watch at a
// particular version.
Watch(ctx api.Context, options *api.ListOptions) (watch.Interface, error)
Watch(ctx api.Context, options *unversioned.ListOptions) (watch.Interface, error)
}
// StandardStorage is an interface covering the common verbs. Provided for testing whether a

View File

@@ -864,7 +864,7 @@ func (t *Tester) testListMatchLabels(obj runtime.Object, assignFn AssignFunc) {
filtered := []runtime.Object{objs[1]}
selector := labels.SelectorFromSet(labels.Set(testLabels))
options := &api.ListOptions{LabelSelector: selector}
options := &unversioned.ListOptions{LabelSelector: unversioned.LabelSelector{selector}}
listObj, err := t.storage.(rest.Lister).List(ctx, options)
if err != nil {
t.Errorf("unexpected error: %v", err)
@@ -906,7 +906,7 @@ func (t *Tester) testWatchFields(obj runtime.Object, emitFn EmitFunc, fieldsPass
for _, field := range fieldsPass {
for _, action := range actions {
options := &api.ListOptions{FieldSelector: field.AsSelector(), ResourceVersion: "1"}
options := &unversioned.ListOptions{FieldSelector: unversioned.FieldSelector{field.AsSelector()}, ResourceVersion: "1"}
watcher, err := t.storage.(rest.Watcher).Watch(ctx, options)
if err != nil {
t.Errorf("unexpected error: %v, %v", err, action)
@@ -930,7 +930,7 @@ func (t *Tester) testWatchFields(obj runtime.Object, emitFn EmitFunc, fieldsPass
for _, field := range fieldsFail {
for _, action := range actions {
options := &api.ListOptions{FieldSelector: field.AsSelector(), ResourceVersion: "1"}
options := &unversioned.ListOptions{FieldSelector: unversioned.FieldSelector{field.AsSelector()}, ResourceVersion: "1"}
watcher, err := t.storage.(rest.Watcher).Watch(ctx, options)
if err != nil {
t.Errorf("unexpected error: %v", err)
@@ -955,7 +955,7 @@ func (t *Tester) testWatchLabels(obj runtime.Object, emitFn EmitFunc, labelsPass
for _, label := range labelsPass {
for _, action := range actions {
options := &api.ListOptions{LabelSelector: label.AsSelector(), ResourceVersion: "1"}
options := &unversioned.ListOptions{LabelSelector: unversioned.LabelSelector{label.AsSelector()}, ResourceVersion: "1"}
watcher, err := t.storage.(rest.Watcher).Watch(ctx, options)
if err != nil {
t.Errorf("unexpected error: %v", err)
@@ -978,7 +978,7 @@ func (t *Tester) testWatchLabels(obj runtime.Object, emitFn EmitFunc, labelsPass
for _, label := range labelsFail {
for _, action := range actions {
options := &api.ListOptions{LabelSelector: label.AsSelector(), ResourceVersion: "1"}
options := &unversioned.ListOptions{LabelSelector: unversioned.LabelSelector{label.AsSelector()}, ResourceVersion: "1"}
watcher, err := t.storage.(rest.Watcher).Watch(ctx, options)
if err != nil {
t.Errorf("unexpected error: %v", err)