Skip to content

Commit 8708fd5

Browse files
committed
collapse onto upstream storage RESTOptions
1 parent b8be8a7 commit 8708fd5

File tree

33 files changed

+56
-104
lines changed

33 files changed

+56
-104
lines changed

pkg/apps/apiserver/registry/deployconfig/etcd/etcd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"github.com/openshift/origin/pkg/apps/apiserver/registry/deployconfig"
2828
appsutil "github.com/openshift/origin/pkg/apps/util"
2929
printersinternal "github.com/openshift/origin/pkg/printers/internalversion"
30-
"github.com/openshift/origin/pkg/util/restoptions"
3130
)
3231

3332
// REST contains the REST storage for DeploymentConfig objects.
@@ -52,7 +51,7 @@ func (r *REST) ShortNames() []string {
5251
// NewREST returns a deploymentConfigREST containing the REST storage for DeploymentConfig objects,
5352
// a statusREST containing the REST storage for changing the status of a DeploymentConfig,
5453
// and a scaleREST containing the REST storage for the Scale subresources of DeploymentConfigs.
55-
func NewREST(optsGetter restoptions.Getter) (*REST, *StatusREST, *ScaleREST, error) {
54+
func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *StatusREST, *ScaleREST, error) {
5655
store := &registry.Store{
5756
NewFunc: func() runtime.Object { return &appsapi.DeploymentConfig{} },
5857
NewListFunc: func() runtime.Object { return &appsapi.DeploymentConfigList{} },

pkg/authorization/apiserver/registry/rolebindingrestriction/etcd/etcd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
authorizationapi "github.com/openshift/origin/pkg/authorization/apis/authorization"
1313
"github.com/openshift/origin/pkg/authorization/apiserver/registry/rolebindingrestriction"
1414
printersinternal "github.com/openshift/origin/pkg/printers/internalversion"
15-
"github.com/openshift/origin/pkg/util/restoptions"
1615
)
1716

1817
type REST struct {
@@ -22,7 +21,7 @@ type REST struct {
2221
var _ rest.StandardStorage = &REST{}
2322

2423
// NewREST returns a RESTStorage object that will work against nodes.
25-
func NewREST(optsGetter restoptions.Getter) (*REST, error) {
24+
func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, error) {
2625
store := &registry.Store{
2726
NewFunc: func() runtime.Object { return &authorizationapi.RoleBindingRestriction{} },
2827
NewListFunc: func() runtime.Object { return &authorizationapi.RoleBindingRestrictionList{} },

pkg/build/apiserver/registry/build/etcd/etcd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
buildapi "github.com/openshift/origin/pkg/build/apis/build"
1616
buildregistry "github.com/openshift/origin/pkg/build/apiserver/registry/build"
1717
printersinternal "github.com/openshift/origin/pkg/printers/internalversion"
18-
"github.com/openshift/origin/pkg/util/restoptions"
1918
)
2019

2120
type REST struct {
@@ -31,7 +30,7 @@ func (r *REST) Categories() []string {
3130
}
3231

3332
// NewREST returns a RESTStorage object that will work against Build objects.
34-
func NewREST(optsGetter restoptions.Getter) (*REST, *DetailsREST, error) {
33+
func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *DetailsREST, error) {
3534
store := &registry.Store{
3635
NewFunc: func() runtime.Object { return &buildapi.Build{} },
3736
NewListFunc: func() runtime.Object { return &buildapi.BuildList{} },

pkg/build/apiserver/registry/buildconfig/etcd/etcd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
buildapi "github.com/openshift/origin/pkg/build/apis/build"
1313
"github.com/openshift/origin/pkg/build/apiserver/registry/buildconfig"
1414
printersinternal "github.com/openshift/origin/pkg/printers/internalversion"
15-
"github.com/openshift/origin/pkg/util/restoptions"
1615
)
1716

1817
type REST struct {
@@ -34,7 +33,7 @@ func (r *REST) ShortNames() []string {
3433
}
3534

3635
// NewREST returns a RESTStorage object that will work against BuildConfig.
37-
func NewREST(optsGetter restoptions.Getter) (*REST, error) {
36+
func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, error) {
3837
store := &registry.Store{
3938
NewFunc: func() runtime.Object { return &buildapi.BuildConfig{} },
4039
NewListFunc: func() runtime.Object { return &buildapi.BuildConfigList{} },

pkg/cmd/openshift-apiserver/openshiftapiserver/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"github.com/openshift/origin/pkg/image/apiserver/registryhostname"
2929
sccstorage "github.com/openshift/origin/pkg/security/apiserver/registry/securitycontextconstraints/etcd"
3030
usercache "github.com/openshift/origin/pkg/user/cache"
31-
"github.com/openshift/origin/pkg/util/restoptions"
3231
"github.com/openshift/origin/pkg/version"
3332
)
3433

@@ -49,7 +48,7 @@ func NewOpenshiftAPIConfig(openshiftAPIServerConfig *configapi.MasterConfig) (*O
4948
if err != nil {
5049
return nil, err
5150
}
52-
restOptsGetter, err := restoptions.NewConfigGetter(*openshiftAPIServerConfig)
51+
restOptsGetter, err := NewRESTOptionsGetter(*openshiftAPIServerConfig)
5352
if err != nil {
5453
return nil, err
5554
}

pkg/util/restoptions/configgetter.go renamed to pkg/cmd/openshift-apiserver/openshiftapiserver/restoptionsgetter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
package restoptions
1+
package openshiftapiserver
22

33
import (
44
"strconv"
55

66
"k8s.io/apimachinery/pkg/runtime/schema"
7+
genericregistry "k8s.io/apiserver/pkg/registry/generic"
78
"k8s.io/apiserver/pkg/server/options"
89
apiserverstorage "k8s.io/apiserver/pkg/server/storage"
910
serverstorage "k8s.io/apiserver/pkg/server/storage"
@@ -14,8 +15,7 @@ import (
1415
)
1516

1617
// NewConfigGetter returns a restoptions.Getter implemented using information from the provided master config.
17-
// TODO: this class should either not need to know about configapi.MasterConfig, or not be in pkg/util
18-
func NewConfigGetter(masterOptions configapi.MasterConfig) (Getter, error) {
18+
func NewRESTOptionsGetter(masterOptions configapi.MasterConfig) (genericregistry.RESTOptionsGetter, error) {
1919
var err error
2020
targetRAMMB := 0
2121
if targetRamString := masterOptions.KubernetesMasterConfig.APIServerArguments["target-ram-mb"]; len(targetRamString) == 1 {

pkg/cmd/server/origin/master_config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"k8s.io/apiserver/pkg/admission"
99
admissionmetrics "k8s.io/apiserver/pkg/admission/metrics"
1010
"k8s.io/apiserver/pkg/audit"
11+
genericregistry "k8s.io/apiserver/pkg/registry/generic"
1112
genericapiserver "k8s.io/apiserver/pkg/server"
1213
cacheddiscovery "k8s.io/client-go/discovery/cached"
1314
kinformers "k8s.io/client-go/informers"
@@ -39,7 +40,6 @@ import (
3940
"github.com/openshift/origin/pkg/cmd/openshift-apiserver/openshiftapiserver"
4041
"github.com/openshift/origin/pkg/image/apiserver/registryhostname"
4142
securityinformer "github.com/openshift/origin/pkg/security/generated/informers/internalversion"
42-
"github.com/openshift/origin/pkg/util/restoptions"
4343
)
4444

4545
// MasterConfig defines the required parameters for starting the OpenShift master
@@ -52,7 +52,7 @@ type MasterConfig struct {
5252
additionalPostStartHooks map[string]genericapiserver.PostStartHookFunc
5353

5454
// RESTOptionsGetter provides access to storage and RESTOptions for a particular resource
55-
RESTOptionsGetter restoptions.Getter
55+
RESTOptionsGetter genericregistry.RESTOptionsGetter
5656

5757
RuleResolver rbacregistryvalidation.AuthorizationRuleResolver
5858
SubjectLocator rbacauthorizer.SubjectLocator
@@ -130,7 +130,7 @@ func BuildMasterConfig(
130130
informers = realLoopbackInformers
131131
}
132132

133-
restOptsGetter, err := restoptions.NewConfigGetter(options)
133+
restOptsGetter, err := openshiftapiserver.NewRESTOptionsGetter(options)
134134
if err != nil {
135135
return nil, err
136136
}

pkg/image/apiserver/registry/image/etcd/etcd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
imageapi "github.com/openshift/origin/pkg/image/apis/image"
1313
imageregistry "github.com/openshift/origin/pkg/image/apiserver/registry/image"
1414
printersinternal "github.com/openshift/origin/pkg/printers/internalversion"
15-
"github.com/openshift/origin/pkg/util/restoptions"
1615
)
1716

1817
// REST implements a RESTStorage for images against etcd.
@@ -23,7 +22,7 @@ type REST struct {
2322
var _ rest.StandardStorage = &REST{}
2423

2524
// NewREST returns a new REST.
26-
func NewREST(optsGetter restoptions.Getter) (*REST, error) {
25+
func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, error) {
2726
store := &registry.Store{
2827
NewFunc: func() runtime.Object { return &imageapi.Image{} },
2928
NewListFunc: func() runtime.Object { return &imageapi.ImageList{} },

pkg/image/apiserver/registry/image/etcd/etcd_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@ import (
99
"k8s.io/apimachinery/pkg/runtime"
1010
"k8s.io/apimachinery/pkg/runtime/schema"
1111
apirequest "k8s.io/apiserver/pkg/endpoints/request"
12+
"k8s.io/apiserver/pkg/registry/generic"
1213
genericregistrytest "k8s.io/apiserver/pkg/registry/generic/testing"
1314
"k8s.io/apiserver/pkg/registry/rest"
1415
etcdtesting "k8s.io/apiserver/pkg/storage/etcd/testing"
1516
"k8s.io/kubernetes/pkg/api/legacyscheme"
1617

1718
imageapi "github.com/openshift/origin/pkg/image/apis/image"
1819
"github.com/openshift/origin/pkg/image/apiserver/registry/image"
19-
"github.com/openshift/origin/pkg/util/restoptions"
2020
// install all APIs
2121
_ "github.com/openshift/origin/pkg/api/install"
2222
)
2323

2424
func newStorage(t *testing.T) (*REST, *etcdtesting.EtcdTestServer) {
2525
server, etcdStorage := etcdtesting.NewUnsecuredEtcd3TestClientServer(t)
2626
etcdStorage.Codec = legacyscheme.Codecs.LegacyCodec(schema.GroupVersion{Group: "image.openshift.io", Version: "v1"})
27-
storage, err := NewREST(restoptions.NewSimpleGetter(etcdStorage))
27+
imageRESTOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1, ResourcePrefix: "images"}
28+
storage, err := NewREST(imageRESTOptions)
2829
if err != nil {
2930
t.Fatal(err)
3031
}

pkg/image/apiserver/registry/imagestream/etcd/etcd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"github.com/openshift/origin/pkg/image/apiserver/registry/imagestream"
2525
"github.com/openshift/origin/pkg/image/apiserver/registryhostname"
2626
printersinternal "github.com/openshift/origin/pkg/printers/internalversion"
27-
"github.com/openshift/origin/pkg/util/restoptions"
2827
)
2928

3029
// REST implements a RESTStorage for image streams against etcd.
@@ -48,7 +47,7 @@ func (r *REST) ShortNames() []string {
4847

4948
// NewREST returns a new REST.
5049
func NewREST(
51-
optsGetter restoptions.Getter,
50+
optsGetter generic.RESTOptionsGetter,
5251
registryHostname registryhostname.RegistryHostnameRetriever,
5352
subjectAccessReviewRegistry authorizationclient.SubjectAccessReviewInterface,
5453
limitVerifier imageadmission.LimitVerifier,

pkg/image/apiserver/registry/imagestream/etcd/etcd_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import (
66
imageapi "github.com/openshift/origin/pkg/image/apis/image"
77
"github.com/openshift/origin/pkg/image/apis/image/validation/fake"
88
admfake "github.com/openshift/origin/pkg/image/apiserver/admission/fake"
9-
"github.com/openshift/origin/pkg/util/restoptions"
109
authorizationapi "k8s.io/api/authorization/v1"
1110
"k8s.io/apimachinery/pkg/api/errors"
1211
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1312
"k8s.io/apimachinery/pkg/runtime/schema"
1413
"k8s.io/apiserver/pkg/authentication/user"
1514
apirequest "k8s.io/apiserver/pkg/endpoints/request"
15+
"k8s.io/apiserver/pkg/registry/generic"
1616
genericregistrytest "k8s.io/apiserver/pkg/registry/generic/testing"
1717
"k8s.io/apiserver/pkg/registry/rest"
1818
etcdtesting "k8s.io/apiserver/pkg/storage/etcd/testing"
@@ -53,9 +53,10 @@ func (f *fakeSubjectAccessReviewRegistry) Create(subjectAccessReview *authorizat
5353
func newStorage(t *testing.T) (*REST, *StatusREST, *InternalREST, *etcdtesting.EtcdTestServer) {
5454
server, etcdStorage := etcdtesting.NewUnsecuredEtcd3TestClientServer(t)
5555
etcdStorage.Codec = legacyscheme.Codecs.LegacyCodec(schema.GroupVersion{Group: "image.openshift.io", Version: "v1"})
56+
imagestreamRESTOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1, ResourcePrefix: "imagestreams"}
5657
registry := registryhostname.TestingRegistryHostnameRetriever(noDefaultRegistry, "", "")
5758
imageStorage, _, statusStorage, internalStorage, err := NewREST(
58-
restoptions.NewSimpleGetter(etcdStorage),
59+
imagestreamRESTOptions,
5960
registry,
6061
&fakeSubjectAccessReviewRegistry{},
6162
&admfake.ImageStreamLimitVerifier{},

pkg/image/apiserver/registry/imagestreamimage/rest_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"k8s.io/apimachinery/pkg/runtime"
1212
"k8s.io/apimachinery/pkg/runtime/schema"
1313
apirequest "k8s.io/apiserver/pkg/endpoints/request"
14+
"k8s.io/apiserver/pkg/registry/generic"
1415
"k8s.io/apiserver/pkg/storage/etcd/etcdtest"
1516
etcdtesting "k8s.io/apiserver/pkg/storage/etcd/testing"
1617
"k8s.io/kubernetes/pkg/api/legacyscheme"
@@ -23,10 +24,9 @@ import (
2324
imageetcd "github.com/openshift/origin/pkg/image/apiserver/registry/image/etcd"
2425
"github.com/openshift/origin/pkg/image/apiserver/registry/imagestream"
2526
imagestreametcd "github.com/openshift/origin/pkg/image/apiserver/registry/imagestream/etcd"
26-
"github.com/openshift/origin/pkg/util/restoptions"
27+
"github.com/openshift/origin/pkg/image/apiserver/registryhostname"
2728

2829
_ "github.com/openshift/origin/pkg/api/install"
29-
"github.com/openshift/origin/pkg/image/apiserver/registryhostname"
3030
)
3131

3232
var testDefaultRegistry = func() (string, bool) { return "defaultregistry:5000", true }
@@ -42,13 +42,15 @@ func setup(t *testing.T) (etcd.KV, *etcdtesting.EtcdTestServer, *REST) {
4242
server, etcdStorage := etcdtesting.NewUnsecuredEtcd3TestClientServer(t)
4343
etcdStorage.Codec = legacyscheme.Codecs.LegacyCodec(schema.GroupVersion{Group: "image.openshift.io", Version: "v1"})
4444
etcdClient := etcd.NewKV(server.V3Client)
45+
imageRESTOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1, ResourcePrefix: "images"}
4546

46-
imageStorage, err := imageetcd.NewREST(restoptions.NewSimpleGetter(etcdStorage))
47+
imageStorage, err := imageetcd.NewREST(imageRESTOptions)
4748
if err != nil {
4849
t.Fatal(err)
4950
}
5051
defaultRegistry := registryhostname.TestingRegistryHostnameRetriever(testDefaultRegistry, "", "")
51-
imageStreamStorage, _, imageStreamStatus, internalStorage, err := imagestreametcd.NewREST(restoptions.NewSimpleGetter(etcdStorage), defaultRegistry, &fakeSubjectAccessReviewRegistry{}, &admfake.ImageStreamLimitVerifier{}, &fake.RegistryWhitelister{}, imagestreametcd.NewEmptyLayerIndex())
52+
imagestreamRESTOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1, ResourcePrefix: "imagestreams"}
53+
imageStreamStorage, _, imageStreamStatus, internalStorage, err := imagestreametcd.NewREST(imagestreamRESTOptions, defaultRegistry, &fakeSubjectAccessReviewRegistry{}, &admfake.ImageStreamLimitVerifier{}, &fake.RegistryWhitelister{}, imagestreametcd.NewEmptyLayerIndex())
5254
if err != nil {
5355
t.Fatal(err)
5456
}

pkg/image/apiserver/registry/imagestreammapping/rest_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"k8s.io/apimachinery/pkg/watch"
2121
"k8s.io/apiserver/pkg/authentication/user"
2222
apirequest "k8s.io/apiserver/pkg/endpoints/request"
23+
"k8s.io/apiserver/pkg/registry/generic"
2324
"k8s.io/apiserver/pkg/storage/etcd/etcdtest"
2425
etcdtesting "k8s.io/apiserver/pkg/storage/etcd/testing"
2526
"k8s.io/kubernetes/pkg/api/legacyscheme"
@@ -34,10 +35,9 @@ import (
3435
imageetcd "github.com/openshift/origin/pkg/image/apiserver/registry/image/etcd"
3536
"github.com/openshift/origin/pkg/image/apiserver/registry/imagestream"
3637
imagestreametcd "github.com/openshift/origin/pkg/image/apiserver/registry/imagestream/etcd"
37-
"github.com/openshift/origin/pkg/util/restoptions"
38+
"github.com/openshift/origin/pkg/image/apiserver/registryhostname"
3839

3940
_ "github.com/openshift/origin/pkg/api/install"
40-
"github.com/openshift/origin/pkg/image/apiserver/registryhostname"
4141
)
4242

4343
const testDefaultRegistryURL = "defaultregistry:5000"
@@ -55,13 +55,15 @@ func setup(t *testing.T) (etcd.KV, *etcdtesting.EtcdTestServer, *REST) {
5555
server, etcdStorage := etcdtesting.NewUnsecuredEtcd3TestClientServer(t)
5656
etcdStorage.Codec = legacyscheme.Codecs.LegacyCodec(schema.GroupVersion{Group: "image.openshift.io", Version: "v1"})
5757
etcdClient := etcd.NewKV(server.V3Client)
58+
imageRESTOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1, ResourcePrefix: "images"}
5859

59-
imageStorage, err := imageetcd.NewREST(restoptions.NewSimpleGetter(etcdStorage))
60+
imageStorage, err := imageetcd.NewREST(imageRESTOptions)
6061
if err != nil {
6162
t.Fatal(err)
6263
}
6364
registry := registryhostname.TestingRegistryHostnameRetriever(testDefaultRegistry, "", "")
64-
imageStreamStorage, _, imageStreamStatus, internalStorage, err := imagestreametcd.NewREST(restoptions.NewSimpleGetter(etcdStorage), registry, &fakeSubjectAccessReviewRegistry{}, &admfake.ImageStreamLimitVerifier{}, &fake.RegistryWhitelister{}, imagestreametcd.NewEmptyLayerIndex())
65+
imagestreamRESTOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1, ResourcePrefix: "imagestreams"}
66+
imageStreamStorage, _, imageStreamStatus, internalStorage, err := imagestreametcd.NewREST(imagestreamRESTOptions, registry, &fakeSubjectAccessReviewRegistry{}, &admfake.ImageStreamLimitVerifier{}, &fake.RegistryWhitelister{}, imagestreametcd.NewEmptyLayerIndex())
6567
if err != nil {
6668
t.Fatal(err)
6769
}

pkg/image/apiserver/registry/imagestreamtag/rest_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"k8s.io/apimachinery/pkg/runtime/schema"
1717
"k8s.io/apiserver/pkg/authentication/user"
1818
apirequest "k8s.io/apiserver/pkg/endpoints/request"
19+
"k8s.io/apiserver/pkg/registry/generic"
1920
"k8s.io/apiserver/pkg/storage/etcd/etcdtest"
2021
etcdtesting "k8s.io/apiserver/pkg/storage/etcd/testing"
2122
"k8s.io/kubernetes/pkg/api/legacyscheme"
@@ -29,10 +30,9 @@ import (
2930
imageetcd "github.com/openshift/origin/pkg/image/apiserver/registry/image/etcd"
3031
"github.com/openshift/origin/pkg/image/apiserver/registry/imagestream"
3132
imagestreametcd "github.com/openshift/origin/pkg/image/apiserver/registry/imagestream/etcd"
32-
"github.com/openshift/origin/pkg/util/restoptions"
33+
"github.com/openshift/origin/pkg/image/apiserver/registryhostname"
3334

3435
_ "github.com/openshift/origin/pkg/api/install"
35-
"github.com/openshift/origin/pkg/image/apiserver/registryhostname"
3636
)
3737

3838
var testDefaultRegistry = func() (string, bool) { return "defaultregistry:5000", true }
@@ -69,15 +69,17 @@ func setup(t *testing.T) (etcd.KV, *etcdtesting.EtcdTestServer, *REST) {
6969
server, etcdStorage := etcdtesting.NewUnsecuredEtcd3TestClientServer(t)
7070
etcdStorage.Codec = legacyscheme.Codecs.LegacyCodec(schema.GroupVersion{Group: "image.openshift.io", Version: "v1"})
7171
etcdClient := etcd.NewKV(server.V3Client)
72+
imagestreamRESTOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1, ResourcePrefix: "imagestreams"}
7273
rw := &fake.RegistryWhitelister{}
7374

74-
imageStorage, err := imageetcd.NewREST(restoptions.NewSimpleGetter(etcdStorage))
75+
imageRESTOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1, ResourcePrefix: "images"}
76+
imageStorage, err := imageetcd.NewREST(imageRESTOptions)
7577
if err != nil {
7678
t.Fatal(err)
7779
}
7880
registry := registryhostname.TestingRegistryHostnameRetriever(testDefaultRegistry, "", "")
7981
imageStreamStorage, _, imageStreamStatus, internalStorage, err := imagestreametcd.NewREST(
80-
restoptions.NewSimpleGetter(etcdStorage),
82+
imagestreamRESTOptions,
8183
registry,
8284
&fakeSubjectAccessReviewRegistry{},
8385
&admfake.ImageStreamLimitVerifier{},

pkg/network/apiserver/registry/clusternetwork/etcd/etcd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
networkapi "github.com/openshift/origin/pkg/network/apis/network"
1313
"github.com/openshift/origin/pkg/network/apiserver/registry/clusternetwork"
1414
printersinternal "github.com/openshift/origin/pkg/printers/internalversion"
15-
"github.com/openshift/origin/pkg/util/restoptions"
1615
)
1716

1817
// rest implements a RESTStorage for sdn against etcd
@@ -23,7 +22,7 @@ type REST struct {
2322
var _ rest.StandardStorage = &REST{}
2423

2524
// NewREST returns a RESTStorage object that will work against subnets
26-
func NewREST(optsGetter restoptions.Getter) (*REST, error) {
25+
func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, error) {
2726
store := &registry.Store{
2827
NewFunc: func() runtime.Object { return &networkapi.ClusterNetwork{} },
2928
NewListFunc: func() runtime.Object { return &networkapi.ClusterNetworkList{} },

pkg/network/apiserver/registry/egressnetworkpolicy/etcd/etcd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
networkapi "github.com/openshift/origin/pkg/network/apis/network"
1313
"github.com/openshift/origin/pkg/network/apiserver/registry/egressnetworkpolicy"
1414
printersinternal "github.com/openshift/origin/pkg/printers/internalversion"
15-
"github.com/openshift/origin/pkg/util/restoptions"
1615
)
1716

1817
// rest implements a RESTStorage for egress network policy against etcd
@@ -23,7 +22,7 @@ type REST struct {
2322
var _ rest.StandardStorage = &REST{}
2423

2524
// NewREST returns a RESTStorage object that will work against egress network policy
26-
func NewREST(optsGetter restoptions.Getter) (*REST, error) {
25+
func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, error) {
2726
store := &registry.Store{
2827
NewFunc: func() runtime.Object { return &networkapi.EgressNetworkPolicy{} },
2928
NewListFunc: func() runtime.Object { return &networkapi.EgressNetworkPolicyList{} },

0 commit comments

Comments
 (0)