Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
aa3db4d9
Commit
aa3db4d9
authored
Jul 25, 2016
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make the resource prefix in etcd configurable for cohabitation
parent
27bb99d4
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
99 additions
and
49 deletions
+99
-49
server.go
cmd/kube-apiserver/app/server.go
+4
-3
server.go
federation/cmd/federation-apiserver/app/server.go
+1
-0
tokengetter.go
pkg/controller/serviceaccount/tokengetter.go
+3
-3
storage_factory.go
pkg/genericapiserver/storage_factory.go
+46
-1
master.go
pkg/master/master.go
+1
-0
etcd.go
pkg/registry/clusterrole/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/clusterrolebinding/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/configmap/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/controller/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/daemonset/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/deployment/etcd/etcd.go
+1
-1
etcd_test.go
pkg/registry/deployment/etcd/etcd_test.go
+1
-1
etcd.go
pkg/registry/endpoint/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/event/etcd/etcd.go
+1
-1
etcd_test.go
pkg/registry/experimental/controller/etcd/etcd_test.go
+1
-1
options.go
pkg/registry/generic/options.go
+2
-0
etcd.go
pkg/registry/horizontalpodautoscaler/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/ingress/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/job/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/limitrange/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/namespace/etcd/etcd.go
+1
-1
etcd_test.go
pkg/registry/namespace/etcd/etcd_test.go
+1
-1
etcd.go
pkg/registry/networkpolicy/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/node/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/persistentvolume/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/persistentvolumeclaim/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/petset/etcd/etcd.go
+1
-1
etcd_test.go
pkg/registry/petset/etcd/etcd_test.go
+1
-1
etcd.go
pkg/registry/pod/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/poddisruptionbudget/etcd/etcd.go
+1
-1
etcd_test.go
pkg/registry/poddisruptionbudget/etcd/etcd_test.go
+1
-1
etcd.go
pkg/registry/podsecuritypolicy/etcd/etcd.go
+5
-5
etcd.go
pkg/registry/podtemplate/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/replicaset/etcd/etcd.go
+1
-1
etcd_test.go
pkg/registry/replicaset/etcd/etcd_test.go
+1
-1
etcd.go
pkg/registry/resourcequota/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/role/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/rolebinding/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/scheduledjob/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/secret/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/service/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/serviceaccount/etcd/etcd.go
+1
-1
etcd.go
pkg/registry/thirdpartyresource/etcd/etcd.go
+1
-1
rbac_test.go
test/integration/auth/rbac_test.go
+1
-1
No files found.
cmd/kube-apiserver/app/server.go
View file @
aa3db4d9
...
@@ -38,6 +38,7 @@ import (
...
@@ -38,6 +38,7 @@ import (
"k8s.io/kubernetes/pkg/apis/autoscaling"
"k8s.io/kubernetes/pkg/apis/autoscaling"
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/apiserver"
"k8s.io/kubernetes/pkg/apiserver"
"k8s.io/kubernetes/pkg/apiserver/authenticator"
"k8s.io/kubernetes/pkg/apiserver/authenticator"
"k8s.io/kubernetes/pkg/capabilities"
"k8s.io/kubernetes/pkg/capabilities"
...
@@ -185,7 +186,7 @@ func Run(s *options.APIServer) error {
...
@@ -185,7 +186,7 @@ func Run(s *options.APIServer) error {
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Fatalf
(
"Unable to get serviceaccounts storage: %v"
,
err
)
glog
.
Fatalf
(
"Unable to get serviceaccounts storage: %v"
,
err
)
}
}
serviceAccountGetter
=
serviceaccountcontroller
.
NewGetterFromStorageInterface
(
storage
)
serviceAccountGetter
=
serviceaccountcontroller
.
NewGetterFromStorageInterface
(
storage
,
storageFactory
.
ResourcePrefix
(
api
.
Resource
(
"serviceaccounts"
)),
storageFactory
.
ResourcePrefix
(
api
.
Resource
(
"secrets"
))
)
}
}
authenticator
,
err
:=
authenticator
.
New
(
authenticator
.
AuthenticatorConfig
{
authenticator
,
err
:=
authenticator
.
New
(
authenticator
.
AuthenticatorConfig
{
...
@@ -222,11 +223,11 @@ func Run(s *options.APIServer) error {
...
@@ -222,11 +223,11 @@ func Run(s *options.APIServer) error {
if
modeEnabled
(
apiserver
.
ModeRBAC
)
{
if
modeEnabled
(
apiserver
.
ModeRBAC
)
{
mustGetRESTOptions
:=
func
(
resource
string
)
generic
.
RESTOptions
{
mustGetRESTOptions
:=
func
(
resource
string
)
generic
.
RESTOptions
{
s
,
err
:=
storageFactory
.
New
(
api
.
Resource
(
resource
))
s
,
err
:=
storageFactory
.
New
(
rbac
.
Resource
(
resource
))
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Fatalf
(
"Unable to get %s storage: %v"
,
resource
,
err
)
glog
.
Fatalf
(
"Unable to get %s storage: %v"
,
resource
,
err
)
}
}
return
generic
.
RESTOptions
{
Storage
:
s
,
Decorator
:
generic
.
UndecoratedStorage
}
return
generic
.
RESTOptions
{
Storage
:
s
,
Decorator
:
generic
.
UndecoratedStorage
,
ResourcePrefix
:
storageFactory
.
ResourcePrefix
(
rbac
.
Resource
(
resource
))
}
}
}
// For initial bootstrapping go directly to etcd to avoid privillege escalation check.
// For initial bootstrapping go directly to etcd to avoid privillege escalation check.
...
...
federation/cmd/federation-apiserver/app/server.go
View file @
aa3db4d9
...
@@ -168,5 +168,6 @@ func createRESTOptionsOrDie(s *genericoptions.ServerRunOptions, g *genericapiser
...
@@ -168,5 +168,6 @@ func createRESTOptionsOrDie(s *genericoptions.ServerRunOptions, g *genericapiser
Storage
:
storage
,
Storage
:
storage
,
Decorator
:
g
.
StorageDecorator
(),
Decorator
:
g
.
StorageDecorator
(),
DeleteCollectionWorkers
:
s
.
DeleteCollectionWorkers
,
DeleteCollectionWorkers
:
s
.
DeleteCollectionWorkers
,
ResourcePrefix
:
f
.
ResourcePrefix
(
resource
),
}
}
}
}
pkg/controller/serviceaccount/tokengetter.go
View file @
aa3db4d9
...
@@ -69,9 +69,9 @@ func (r *registryGetter) GetSecret(namespace, name string) (*api.Secret, error)
...
@@ -69,9 +69,9 @@ func (r *registryGetter) GetSecret(namespace, name string) (*api.Secret, error)
// NewGetterFromStorageInterface returns a ServiceAccountTokenGetter that
// NewGetterFromStorageInterface returns a ServiceAccountTokenGetter that
// uses the specified storage to retrieve service accounts and secrets.
// uses the specified storage to retrieve service accounts and secrets.
func
NewGetterFromStorageInterface
(
s
storage
.
Interface
)
serviceaccount
.
ServiceAccountTokenGetter
{
func
NewGetterFromStorageInterface
(
s
storage
.
Interface
,
saPrefix
,
secretPrefix
string
)
serviceaccount
.
ServiceAccountTokenGetter
{
return
NewGetterFromRegistries
(
return
NewGetterFromRegistries
(
serviceaccountregistry
.
NewRegistry
(
serviceaccountetcd
.
NewREST
(
generic
.
RESTOptions
{
Storage
:
s
,
Decorator
:
generic
.
UndecoratedStorage
})),
serviceaccountregistry
.
NewRegistry
(
serviceaccountetcd
.
NewREST
(
generic
.
RESTOptions
{
Storage
:
s
,
Decorator
:
generic
.
UndecoratedStorage
,
ResourcePrefix
:
saPrefix
})),
secret
.
NewRegistry
(
secretetcd
.
NewREST
(
generic
.
RESTOptions
{
Storage
:
s
,
Decorator
:
generic
.
UndecoratedStorage
})),
secret
.
NewRegistry
(
secretetcd
.
NewREST
(
generic
.
RESTOptions
{
Storage
:
s
,
Decorator
:
generic
.
UndecoratedStorage
,
ResourcePrefix
:
secretPrefix
})),
)
)
}
}
pkg/genericapiserver/storage_factory.go
View file @
aa3db4d9
...
@@ -19,6 +19,7 @@ package genericapiserver
...
@@ -19,6 +19,7 @@ package genericapiserver
import
(
import
(
"fmt"
"fmt"
"mime"
"mime"
"strings"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
...
@@ -37,6 +38,12 @@ type StorageFactory interface {
...
@@ -37,6 +38,12 @@ type StorageFactory interface {
// New finds the storage destination for the given group and resource. It will
// New finds the storage destination for the given group and resource. It will
// return an error if the group has no storage destination configured.
// return an error if the group has no storage destination configured.
New
(
groupResource
unversioned
.
GroupResource
)
(
storage
.
Interface
,
error
)
New
(
groupResource
unversioned
.
GroupResource
)
(
storage
.
Interface
,
error
)
// ResourcePrefix returns the overridden resource prefix for the GroupResource
// This allows for cohabitation of resources with different native types and provides
// centralized control over the shape of etcd directories
ResourcePrefix
(
groupResource
unversioned
.
GroupResource
)
string
// Backends gets all backends for all registered storage destinations.
// Backends gets all backends for all registered storage destinations.
// Used for getting all instances for health validations.
// Used for getting all instances for health validations.
Backends
()
[]
string
Backends
()
[]
string
...
@@ -78,8 +85,12 @@ type groupResourceOverrides struct {
...
@@ -78,8 +85,12 @@ type groupResourceOverrides struct {
// etcdLocation contains the list of "special" locations that are used for particular GroupResources
// etcdLocation contains the list of "special" locations that are used for particular GroupResources
// These are merged on top of the StorageConfig when requesting the storage.Interface for a given GroupResource
// These are merged on top of the StorageConfig when requesting the storage.Interface for a given GroupResource
etcdLocation
[]
string
etcdLocation
[]
string
// etcdPrefix
contains the list of "special" prefixes for a GroupResource. Resource=* means for the entire group
// etcdPrefix
is the base location for a GroupResource.
etcdPrefix
string
etcdPrefix
string
// etcdResourcePrefix is the location to use to store a particular type under the `etcdPrefix` location
// If empty, the default mapping is used. If the default mapping doesn't contain an entry, it will use
// the ToLowered name of the resource, not including the group.
etcdResourcePrefix
string
// mediaType is the desired serializer to choose. If empty, the default is chosen.
// mediaType is the desired serializer to choose. If empty, the default is chosen.
mediaType
string
mediaType
string
// serializer contains the list of "special" serializers for a GroupResource. Resource=* means for the entire group
// serializer contains the list of "special" serializers for a GroupResource. Resource=* means for the entire group
...
@@ -123,6 +134,13 @@ func (s *DefaultStorageFactory) SetEtcdPrefix(groupResource unversioned.GroupRes
...
@@ -123,6 +134,13 @@ func (s *DefaultStorageFactory) SetEtcdPrefix(groupResource unversioned.GroupRes
s
.
Overrides
[
groupResource
]
=
overrides
s
.
Overrides
[
groupResource
]
=
overrides
}
}
// SetResourceEtcdPrefix sets the prefix for a resource, but not the base-dir. You'll end up in `etcdPrefix/resourceEtcdPrefix`.
func
(
s
*
DefaultStorageFactory
)
SetResourceEtcdPrefix
(
groupResource
unversioned
.
GroupResource
,
prefix
string
)
{
overrides
:=
s
.
Overrides
[
groupResource
]
overrides
.
etcdResourcePrefix
=
prefix
s
.
Overrides
[
groupResource
]
=
overrides
}
func
(
s
*
DefaultStorageFactory
)
SetSerializer
(
groupResource
unversioned
.
GroupResource
,
mediaType
string
,
serializer
runtime
.
StorageSerializer
)
{
func
(
s
*
DefaultStorageFactory
)
SetSerializer
(
groupResource
unversioned
.
GroupResource
,
mediaType
string
,
serializer
runtime
.
StorageSerializer
)
{
overrides
:=
s
.
Overrides
[
groupResource
]
overrides
:=
s
.
Overrides
[
groupResource
]
overrides
.
mediaType
=
mediaType
overrides
.
mediaType
=
mediaType
...
@@ -268,3 +286,30 @@ func NewStorageCodec(storageMediaType string, ns runtime.StorageSerializer, stor
...
@@ -268,3 +286,30 @@ func NewStorageCodec(storageMediaType string, ns runtime.StorageSerializer, stor
}
}
return
runtime
.
NewCodec
(
encoder
,
decoder
),
nil
return
runtime
.
NewCodec
(
encoder
,
decoder
),
nil
}
}
var
specialDefaultResourcePrefixes
=
map
[
unversioned
.
GroupResource
]
string
{
unversioned
.
GroupResource
{
Group
:
""
,
Resource
:
"replicationControllers"
}
:
"controllers"
,
unversioned
.
GroupResource
{
Group
:
""
,
Resource
:
"replicationcontrollers"
}
:
"controllers"
,
unversioned
.
GroupResource
{
Group
:
""
,
Resource
:
"endpoints"
}
:
"services/endpoints"
,
unversioned
.
GroupResource
{
Group
:
""
,
Resource
:
"nodes"
}
:
"minions"
,
unversioned
.
GroupResource
{
Group
:
""
,
Resource
:
"services"
}
:
"services/specs"
,
}
func
(
s
*
DefaultStorageFactory
)
ResourcePrefix
(
groupResource
unversioned
.
GroupResource
)
string
{
chosenStorageResource
:=
s
.
getStorageGroupResource
(
groupResource
)
groupOverride
:=
s
.
Overrides
[
getAllResourcesAlias
(
chosenStorageResource
)]
exactResourceOverride
:=
s
.
Overrides
[
chosenStorageResource
]
etcdResourcePrefix
:=
specialDefaultResourcePrefixes
[
chosenStorageResource
]
if
len
(
groupOverride
.
etcdResourcePrefix
)
>
0
{
etcdResourcePrefix
=
groupOverride
.
etcdResourcePrefix
}
if
len
(
exactResourceOverride
.
etcdResourcePrefix
)
>
0
{
etcdResourcePrefix
=
exactResourceOverride
.
etcdResourcePrefix
}
if
len
(
etcdResourcePrefix
)
==
0
{
etcdResourcePrefix
=
strings
.
ToLower
(
chosenStorageResource
.
Resource
)
}
return
etcdResourcePrefix
}
pkg/master/master.go
View file @
aa3db4d9
...
@@ -731,6 +731,7 @@ func (m *Master) GetRESTOptionsOrDie(c *Config, resource unversioned.GroupResour
...
@@ -731,6 +731,7 @@ func (m *Master) GetRESTOptionsOrDie(c *Config, resource unversioned.GroupResour
Storage
:
storage
,
Storage
:
storage
,
Decorator
:
m
.
StorageDecorator
(),
Decorator
:
m
.
StorageDecorator
(),
DeleteCollectionWorkers
:
m
.
deleteCollectionWorkers
,
DeleteCollectionWorkers
:
m
.
deleteCollectionWorkers
,
ResourcePrefix
:
c
.
StorageFactory
.
ResourcePrefix
(
resource
),
}
}
}
}
...
...
pkg/registry/clusterrole/etcd/etcd.go
View file @
aa3db4d9
...
@@ -34,7 +34,7 @@ type REST struct {
...
@@ -34,7 +34,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against ClusterRole objects.
// NewREST returns a RESTStorage object that will work against ClusterRole objects.
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
prefix
:=
"/
clusterroles"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
ClusterRoleList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
ClusterRoleList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/clusterrolebinding/etcd/etcd.go
View file @
aa3db4d9
...
@@ -34,7 +34,7 @@ type REST struct {
...
@@ -34,7 +34,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against ClusterRoleBinding objects.
// NewREST returns a RESTStorage object that will work against ClusterRoleBinding objects.
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
prefix
:=
"/
clusterrolebindings"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
ClusterRoleBindingList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
ClusterRoleBindingList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/configmap/etcd/etcd.go
View file @
aa3db4d9
...
@@ -32,7 +32,7 @@ type REST struct {
...
@@ -32,7 +32,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work with ConfigMap objects.
// NewREST returns a RESTStorage object that will work with ConfigMap objects.
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
prefix
:=
"/
configmaps"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ConfigMapList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ConfigMapList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/controller/etcd/etcd.go
View file @
aa3db4d9
...
@@ -59,7 +59,7 @@ type REST struct {
...
@@ -59,7 +59,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against replication controllers.
// NewREST returns a RESTStorage object that will work against replication controllers.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
prefix
:=
"/
controllers"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ReplicationControllerList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ReplicationControllerList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/daemonset/etcd/etcd.go
View file @
aa3db4d9
...
@@ -35,7 +35,7 @@ type REST struct {
...
@@ -35,7 +35,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against DaemonSets.
// NewREST returns a RESTStorage object that will work against DaemonSets.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
prefix
:=
"/
daemonsets"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
DaemonSetList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
DaemonSetList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/deployment/etcd/etcd.go
View file @
aa3db4d9
...
@@ -59,7 +59,7 @@ type REST struct {
...
@@ -59,7 +59,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against deployments.
// NewREST returns a RESTStorage object that will work against deployments.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
,
*
RollbackREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
,
*
RollbackREST
)
{
prefix
:=
"/
deployments"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
DeploymentList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
DeploymentList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/deployment/etcd/etcd_test.go
View file @
aa3db4d9
...
@@ -41,7 +41,7 @@ const defaultReplicas = 100
...
@@ -41,7 +41,7 @@ const defaultReplicas = 100
func
newStorage
(
t
*
testing
.
T
)
(
*
DeploymentStorage
,
*
etcdtesting
.
EtcdTestServer
)
{
func
newStorage
(
t
*
testing
.
T
)
(
*
DeploymentStorage
,
*
etcdtesting
.
EtcdTestServer
)
{
etcdStorage
,
server
:=
registrytest
.
NewEtcdStorage
(
t
,
extensions
.
GroupName
)
etcdStorage
,
server
:=
registrytest
.
NewEtcdStorage
(
t
,
extensions
.
GroupName
)
restOptions
:=
generic
.
RESTOptions
{
Storage
:
etcdStorage
,
Decorator
:
generic
.
UndecoratedStorage
,
DeleteCollectionWorkers
:
1
}
restOptions
:=
generic
.
RESTOptions
{
Storage
:
etcdStorage
,
Decorator
:
generic
.
UndecoratedStorage
,
DeleteCollectionWorkers
:
1
,
ResourcePrefix
:
"deployments"
}
deploymentStorage
:=
NewStorage
(
restOptions
)
deploymentStorage
:=
NewStorage
(
restOptions
)
return
&
deploymentStorage
,
server
return
&
deploymentStorage
,
server
}
}
...
...
pkg/registry/endpoint/etcd/etcd.go
View file @
aa3db4d9
...
@@ -32,7 +32,7 @@ type REST struct {
...
@@ -32,7 +32,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against endpoints.
// NewREST returns a RESTStorage object that will work against endpoints.
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
prefix
:=
"/
services/endpoints"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
EndpointsList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
EndpointsList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/event/etcd/etcd.go
View file @
aa3db4d9
...
@@ -30,7 +30,7 @@ type REST struct {
...
@@ -30,7 +30,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against events.
// NewREST returns a RESTStorage object that will work against events.
func
NewREST
(
opts
generic
.
RESTOptions
,
ttl
uint64
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
,
ttl
uint64
)
*
REST
{
prefix
:=
"/
events"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
// We explicitly do NOT do any decoration here - switching on Cacher
// We explicitly do NOT do any decoration here - switching on Cacher
// for events will lead to too high memory consumption.
// for events will lead to too high memory consumption.
...
...
pkg/registry/experimental/controller/etcd/etcd_test.go
View file @
aa3db4d9
...
@@ -32,7 +32,7 @@ import (
...
@@ -32,7 +32,7 @@ import (
func
newStorage
(
t
*
testing
.
T
)
(
*
ScaleREST
,
*
etcdtesting
.
EtcdTestServer
,
storage
.
Interface
)
{
func
newStorage
(
t
*
testing
.
T
)
(
*
ScaleREST
,
*
etcdtesting
.
EtcdTestServer
,
storage
.
Interface
)
{
etcdStorage
,
server
:=
registrytest
.
NewEtcdStorage
(
t
,
""
)
etcdStorage
,
server
:=
registrytest
.
NewEtcdStorage
(
t
,
""
)
restOptions
:=
generic
.
RESTOptions
{
Storage
:
etcdStorage
,
Decorator
:
generic
.
UndecoratedStorage
,
DeleteCollectionWorkers
:
1
}
restOptions
:=
generic
.
RESTOptions
{
Storage
:
etcdStorage
,
Decorator
:
generic
.
UndecoratedStorage
,
DeleteCollectionWorkers
:
1
,
ResourcePrefix
:
"controllers"
}
return
NewStorage
(
restOptions
)
.
Scale
,
server
,
etcdStorage
return
NewStorage
(
restOptions
)
.
Scale
,
server
,
etcdStorage
}
}
...
...
pkg/registry/generic/options.go
View file @
aa3db4d9
...
@@ -25,4 +25,6 @@ type RESTOptions struct {
...
@@ -25,4 +25,6 @@ type RESTOptions struct {
Storage
pkgstorage
.
Interface
Storage
pkgstorage
.
Interface
Decorator
StorageDecorator
Decorator
StorageDecorator
DeleteCollectionWorkers
int
DeleteCollectionWorkers
int
ResourcePrefix
string
}
}
pkg/registry/horizontalpodautoscaler/etcd/etcd.go
View file @
aa3db4d9
...
@@ -34,7 +34,7 @@ type REST struct {
...
@@ -34,7 +34,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against horizontal pod autoscalers.
// NewREST returns a RESTStorage object that will work against horizontal pod autoscalers.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
prefix
:=
"/
horizontalpodautoscalers"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
autoscaling
.
HorizontalPodAutoscalerList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
autoscaling
.
HorizontalPodAutoscalerList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/ingress/etcd/etcd.go
View file @
aa3db4d9
...
@@ -35,7 +35,7 @@ type REST struct {
...
@@ -35,7 +35,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against replication controllers.
// NewREST returns a RESTStorage object that will work against replication controllers.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
prefix
:=
"/
ingress"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
IngressList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
IngressList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/job/etcd/etcd.go
View file @
aa3db4d9
...
@@ -35,7 +35,7 @@ type REST struct {
...
@@ -35,7 +35,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against Jobs.
// NewREST returns a RESTStorage object that will work against Jobs.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
prefix
:=
"/
jobs"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
batch
.
JobList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
batch
.
JobList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/limitrange/etcd/etcd.go
View file @
aa3db4d9
...
@@ -32,7 +32,7 @@ type REST struct {
...
@@ -32,7 +32,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against horizontal pod autoscalers.
// NewREST returns a RESTStorage object that will work against horizontal pod autoscalers.
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
prefix
:=
"/
limitranges"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
LimitRangeList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
LimitRangeList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/namespace/etcd/etcd.go
View file @
aa3db4d9
...
@@ -50,7 +50,7 @@ type FinalizeREST struct {
...
@@ -50,7 +50,7 @@ type FinalizeREST struct {
// NewREST returns a RESTStorage object that will work against namespaces.
// NewREST returns a RESTStorage object that will work against namespaces.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
,
*
FinalizeREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
,
*
FinalizeREST
)
{
prefix
:=
"/
namespaces"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
NamespaceList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
NamespaceList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/namespace/etcd/etcd_test.go
View file @
aa3db4d9
...
@@ -31,7 +31,7 @@ import (
...
@@ -31,7 +31,7 @@ import (
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
etcdtesting
.
EtcdTestServer
)
{
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
etcdtesting
.
EtcdTestServer
)
{
etcdStorage
,
server
:=
registrytest
.
NewEtcdStorage
(
t
,
""
)
etcdStorage
,
server
:=
registrytest
.
NewEtcdStorage
(
t
,
""
)
restOptions
:=
generic
.
RESTOptions
{
Storage
:
etcdStorage
,
Decorator
:
generic
.
UndecoratedStorage
,
DeleteCollectionWorkers
:
1
}
restOptions
:=
generic
.
RESTOptions
{
Storage
:
etcdStorage
,
Decorator
:
generic
.
UndecoratedStorage
,
DeleteCollectionWorkers
:
1
,
ResourcePrefix
:
"namespaces"
}
namespaceStorage
,
_
,
_
:=
NewREST
(
restOptions
)
namespaceStorage
,
_
,
_
:=
NewREST
(
restOptions
)
return
namespaceStorage
,
server
return
namespaceStorage
,
server
}
}
...
...
pkg/registry/networkpolicy/etcd/etcd.go
View file @
aa3db4d9
...
@@ -34,7 +34,7 @@ type REST struct {
...
@@ -34,7 +34,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against network policies.
// NewREST returns a RESTStorage object that will work against network policies.
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
prefix
:=
"/
networkpolicies"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensionsapi
.
NetworkPolicyList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensionsapi
.
NetworkPolicyList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/node/etcd/etcd.go
View file @
aa3db4d9
...
@@ -66,7 +66,7 @@ func (r *StatusREST) Update(ctx api.Context, name string, objInfo rest.UpdatedOb
...
@@ -66,7 +66,7 @@ func (r *StatusREST) Update(ctx api.Context, name string, objInfo rest.UpdatedOb
// NewREST returns a RESTStorage object that will work against nodes.
// NewREST returns a RESTStorage object that will work against nodes.
func
NewStorage
(
opts
generic
.
RESTOptions
,
connection
client
.
ConnectionInfoGetter
,
proxyTransport
http
.
RoundTripper
)
NodeStorage
{
func
NewStorage
(
opts
generic
.
RESTOptions
,
connection
client
.
ConnectionInfoGetter
,
proxyTransport
http
.
RoundTripper
)
NodeStorage
{
prefix
:=
"/
minions"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
NodeList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
NodeList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/persistentvolume/etcd/etcd.go
View file @
aa3db4d9
...
@@ -33,7 +33,7 @@ type REST struct {
...
@@ -33,7 +33,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against persistent volumes.
// NewREST returns a RESTStorage object that will work against persistent volumes.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
prefix
:=
"/
persistentvolumes"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PersistentVolumeList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PersistentVolumeList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/persistentvolumeclaim/etcd/etcd.go
View file @
aa3db4d9
...
@@ -33,7 +33,7 @@ type REST struct {
...
@@ -33,7 +33,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against persistent volume claims.
// NewREST returns a RESTStorage object that will work against persistent volume claims.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
prefix
:=
"/
persistentvolumeclaims"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PersistentVolumeClaimList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PersistentVolumeClaimList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/petset/etcd/etcd.go
View file @
aa3db4d9
...
@@ -35,7 +35,7 @@ type REST struct {
...
@@ -35,7 +35,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against replication controllers.
// NewREST returns a RESTStorage object that will work against replication controllers.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
prefix
:=
"/
petsets"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
appsapi
.
PetSetList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
appsapi
.
PetSetList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/petset/etcd/etcd_test.go
View file @
aa3db4d9
...
@@ -33,7 +33,7 @@ import (
...
@@ -33,7 +33,7 @@ import (
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
StatusREST
,
*
etcdtesting
.
EtcdTestServer
)
{
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
StatusREST
,
*
etcdtesting
.
EtcdTestServer
)
{
etcdStorage
,
server
:=
registrytest
.
NewEtcdStorage
(
t
,
apps
.
GroupName
)
etcdStorage
,
server
:=
registrytest
.
NewEtcdStorage
(
t
,
apps
.
GroupName
)
restOptions
:=
generic
.
RESTOptions
{
Storage
:
etcdStorage
,
Decorator
:
generic
.
UndecoratedStorage
,
DeleteCollectionWorkers
:
1
}
restOptions
:=
generic
.
RESTOptions
{
Storage
:
etcdStorage
,
Decorator
:
generic
.
UndecoratedStorage
,
DeleteCollectionWorkers
:
1
,
ResourcePrefix
:
"petsets"
}
petSetStorage
,
statusStorage
:=
NewREST
(
restOptions
)
petSetStorage
,
statusStorage
:=
NewREST
(
restOptions
)
return
petSetStorage
,
statusStorage
,
server
return
petSetStorage
,
statusStorage
,
server
}
}
...
...
pkg/registry/pod/etcd/etcd.go
View file @
aa3db4d9
...
@@ -57,7 +57,7 @@ type REST struct {
...
@@ -57,7 +57,7 @@ type REST struct {
// NewStorage returns a RESTStorage object that will work against pods.
// NewStorage returns a RESTStorage object that will work against pods.
func
NewStorage
(
opts
generic
.
RESTOptions
,
k
client
.
ConnectionInfoGetter
,
proxyTransport
http
.
RoundTripper
)
PodStorage
{
func
NewStorage
(
opts
generic
.
RESTOptions
,
k
client
.
ConnectionInfoGetter
,
proxyTransport
http
.
RoundTripper
)
PodStorage
{
prefix
:=
"/
pods"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PodList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PodList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/poddisruptionbudget/etcd/etcd.go
View file @
aa3db4d9
...
@@ -35,7 +35,7 @@ type REST struct {
...
@@ -35,7 +35,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against pod disruption budgets.
// NewREST returns a RESTStorage object that will work against pod disruption budgets.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
prefix
:=
"/
poddisruptionbudgets"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
policyapi
.
PodDisruptionBudgetList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
policyapi
.
PodDisruptionBudgetList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/poddisruptionbudget/etcd/etcd_test.go
View file @
aa3db4d9
...
@@ -34,7 +34,7 @@ import (
...
@@ -34,7 +34,7 @@ import (
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
StatusREST
,
*
etcdtesting
.
EtcdTestServer
)
{
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
StatusREST
,
*
etcdtesting
.
EtcdTestServer
)
{
etcdStorage
,
server
:=
registrytest
.
NewEtcdStorage
(
t
,
policy
.
GroupName
)
etcdStorage
,
server
:=
registrytest
.
NewEtcdStorage
(
t
,
policy
.
GroupName
)
restOptions
:=
generic
.
RESTOptions
{
Storage
:
etcdStorage
,
Decorator
:
generic
.
UndecoratedStorage
,
DeleteCollectionWorkers
:
1
}
restOptions
:=
generic
.
RESTOptions
{
Storage
:
etcdStorage
,
Decorator
:
generic
.
UndecoratedStorage
,
DeleteCollectionWorkers
:
1
,
ResourcePrefix
:
"poddisruptionbudgets"
}
podDisruptionBudgetStorage
,
statusStorage
:=
NewREST
(
restOptions
)
podDisruptionBudgetStorage
,
statusStorage
:=
NewREST
(
restOptions
)
return
podDisruptionBudgetStorage
,
statusStorage
,
server
return
podDisruptionBudgetStorage
,
statusStorage
,
server
}
}
...
...
pkg/registry/podsecuritypolicy/etcd/etcd.go
View file @
aa3db4d9
...
@@ -31,16 +31,16 @@ type REST struct {
...
@@ -31,16 +31,16 @@ type REST struct {
*
registry
.
Store
*
registry
.
Store
}
}
const
Prefix
=
"/podsecuritypolicies"
// NewREST returns a RESTStorage object that will work against PodSecurityPolicy objects.
// NewREST returns a RESTStorage object that will work against PodSecurityPolicy objects.
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
prefix
:=
"/"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
PodSecurityPolicyList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
PodSecurityPolicyList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
opts
.
Storage
,
opts
.
Storage
,
100
,
100
,
&
extensions
.
PodSecurityPolicy
{},
&
extensions
.
PodSecurityPolicy
{},
P
refix
,
p
refix
,
podsecuritypolicy
.
Strategy
,
podsecuritypolicy
.
Strategy
,
newListFunc
,
newListFunc
,
storage
.
NoTriggerPublisher
,
storage
.
NoTriggerPublisher
,
...
@@ -50,10 +50,10 @@ func NewREST(opts generic.RESTOptions) *REST {
...
@@ -50,10 +50,10 @@ func NewREST(opts generic.RESTOptions) *REST {
NewFunc
:
func
()
runtime
.
Object
{
return
&
extensions
.
PodSecurityPolicy
{}
},
NewFunc
:
func
()
runtime
.
Object
{
return
&
extensions
.
PodSecurityPolicy
{}
},
NewListFunc
:
newListFunc
,
NewListFunc
:
newListFunc
,
KeyRootFunc
:
func
(
ctx
api
.
Context
)
string
{
KeyRootFunc
:
func
(
ctx
api
.
Context
)
string
{
return
P
refix
return
p
refix
},
},
KeyFunc
:
func
(
ctx
api
.
Context
,
name
string
)
(
string
,
error
)
{
KeyFunc
:
func
(
ctx
api
.
Context
,
name
string
)
(
string
,
error
)
{
return
registry
.
NoNamespaceKeyFunc
(
ctx
,
P
refix
,
name
)
return
registry
.
NoNamespaceKeyFunc
(
ctx
,
p
refix
,
name
)
},
},
ObjectNameFunc
:
func
(
obj
runtime
.
Object
)
(
string
,
error
)
{
ObjectNameFunc
:
func
(
obj
runtime
.
Object
)
(
string
,
error
)
{
return
obj
.
(
*
extensions
.
PodSecurityPolicy
)
.
Name
,
nil
return
obj
.
(
*
extensions
.
PodSecurityPolicy
)
.
Name
,
nil
...
...
pkg/registry/podtemplate/etcd/etcd.go
View file @
aa3db4d9
...
@@ -32,7 +32,7 @@ type REST struct {
...
@@ -32,7 +32,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against pod templates.
// NewREST returns a RESTStorage object that will work against pod templates.
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
prefix
:=
"/
podtemplates"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PodTemplateList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
PodTemplateList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/replicaset/etcd/etcd.go
View file @
aa3db4d9
...
@@ -58,7 +58,7 @@ type REST struct {
...
@@ -58,7 +58,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against ReplicaSet.
// NewREST returns a RESTStorage object that will work against ReplicaSet.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
prefix
:=
"/
replicasets"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
ReplicaSetList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
extensions
.
ReplicaSetList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/replicaset/etcd/etcd_test.go
View file @
aa3db4d9
...
@@ -38,7 +38,7 @@ const defaultReplicas = 100
...
@@ -38,7 +38,7 @@ const defaultReplicas = 100
func
newStorage
(
t
*
testing
.
T
)
(
*
ReplicaSetStorage
,
*
etcdtesting
.
EtcdTestServer
)
{
func
newStorage
(
t
*
testing
.
T
)
(
*
ReplicaSetStorage
,
*
etcdtesting
.
EtcdTestServer
)
{
etcdStorage
,
server
:=
registrytest
.
NewEtcdStorage
(
t
,
"extensions"
)
etcdStorage
,
server
:=
registrytest
.
NewEtcdStorage
(
t
,
"extensions"
)
restOptions
:=
generic
.
RESTOptions
{
Storage
:
etcdStorage
,
Decorator
:
generic
.
UndecoratedStorage
,
DeleteCollectionWorkers
:
1
}
restOptions
:=
generic
.
RESTOptions
{
Storage
:
etcdStorage
,
Decorator
:
generic
.
UndecoratedStorage
,
DeleteCollectionWorkers
:
1
,
ResourcePrefix
:
"replicasets"
}
replicaSetStorage
:=
NewStorage
(
restOptions
)
replicaSetStorage
:=
NewStorage
(
restOptions
)
return
&
replicaSetStorage
,
server
return
&
replicaSetStorage
,
server
}
}
...
...
pkg/registry/resourcequota/etcd/etcd.go
View file @
aa3db4d9
...
@@ -33,7 +33,7 @@ type REST struct {
...
@@ -33,7 +33,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against resource quotas.
// NewREST returns a RESTStorage object that will work against resource quotas.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
prefix
:=
"/
resourcequotas"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ResourceQuotaList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ResourceQuotaList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/role/etcd/etcd.go
View file @
aa3db4d9
...
@@ -34,7 +34,7 @@ type REST struct {
...
@@ -34,7 +34,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against Role objects.
// NewREST returns a RESTStorage object that will work against Role objects.
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
prefix
:=
"/
roles"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
RoleList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
RoleList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/rolebinding/etcd/etcd.go
View file @
aa3db4d9
...
@@ -34,7 +34,7 @@ type REST struct {
...
@@ -34,7 +34,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against RoleBinding objects.
// NewREST returns a RESTStorage object that will work against RoleBinding objects.
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
prefix
:=
"/
rolebindings"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
RoleBindingList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
rbac
.
RoleBindingList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/scheduledjob/etcd/etcd.go
View file @
aa3db4d9
...
@@ -35,7 +35,7 @@ type REST struct {
...
@@ -35,7 +35,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against ScheduledJobs.
// NewREST returns a RESTStorage object that will work against ScheduledJobs.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
prefix
:=
"/
scheduledjobs"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
batch
.
ScheduledJobList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
batch
.
ScheduledJobList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/secret/etcd/etcd.go
View file @
aa3db4d9
...
@@ -32,7 +32,7 @@ type REST struct {
...
@@ -32,7 +32,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against secrets.
// NewREST returns a RESTStorage object that will work against secrets.
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
prefix
:=
"/
secrets"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
SecretList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
SecretList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/service/etcd/etcd.go
View file @
aa3db4d9
...
@@ -33,7 +33,7 @@ type REST struct {
...
@@ -33,7 +33,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against services.
// NewREST returns a RESTStorage object that will work against services.
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
func
NewREST
(
opts
generic
.
RESTOptions
)
(
*
REST
,
*
StatusREST
)
{
prefix
:=
"/
services/specs"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ServiceList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ServiceList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/serviceaccount/etcd/etcd.go
View file @
aa3db4d9
...
@@ -32,7 +32,7 @@ type REST struct {
...
@@ -32,7 +32,7 @@ type REST struct {
// NewREST returns a RESTStorage object that will work against service accounts.
// NewREST returns a RESTStorage object that will work against service accounts.
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
prefix
:=
"/
serviceaccounts"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ServiceAccountList
{}
}
newListFunc
:=
func
()
runtime
.
Object
{
return
&
api
.
ServiceAccountList
{}
}
storageInterface
:=
opts
.
Decorator
(
storageInterface
:=
opts
.
Decorator
(
...
...
pkg/registry/thirdpartyresource/etcd/etcd.go
View file @
aa3db4d9
...
@@ -32,7 +32,7 @@ type REST struct {
...
@@ -32,7 +32,7 @@ type REST struct {
// NewREST returns a registry which will store ThirdPartyResource in the given helper
// NewREST returns a registry which will store ThirdPartyResource in the given helper
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
func
NewREST
(
opts
generic
.
RESTOptions
)
*
REST
{
prefix
:=
"/
thirdpartyresources"
prefix
:=
"/
"
+
opts
.
ResourcePrefix
// We explicitly do NOT do any decoration here yet.
// We explicitly do NOT do any decoration here yet.
storageInterface
:=
opts
.
Storage
storageInterface
:=
opts
.
Storage
...
...
test/integration/auth/rbac_test.go
View file @
aa3db4d9
...
@@ -81,7 +81,7 @@ func newRBACAuthorizer(t *testing.T, superUser string, config *master.Config) au
...
@@ -81,7 +81,7 @@ func newRBACAuthorizer(t *testing.T, superUser string, config *master.Config) au
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"failed to get storage: %v"
,
err
)
t
.
Fatalf
(
"failed to get storage: %v"
,
err
)
}
}
return
generic
.
RESTOptions
{
Storage
:
storageInterface
,
Decorator
:
generic
.
UndecoratedStorage
}
return
generic
.
RESTOptions
{
Storage
:
storageInterface
,
Decorator
:
generic
.
UndecoratedStorage
,
ResourcePrefix
:
resource
}
}
}
roleRegistry
:=
role
.
NewRegistry
(
roleetcd
.
NewREST
(
newRESTOptions
(
"roles"
)))
roleRegistry
:=
role
.
NewRegistry
(
roleetcd
.
NewREST
(
newRESTOptions
(
"roles"
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment