mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-19 00:19:14 +00:00
move new etcd storage into cacher
This commit is contained in:
@@ -78,13 +78,13 @@ func Run(serverOptions *genericoptions.ServerRunOptions) error {
|
||||
return fmt.Errorf("%v", err)
|
||||
}
|
||||
storageFactory := newStorageFactory()
|
||||
storage, err := storageFactory.New(unversioned.GroupResource{Group: groupName, Resource: "testtype"})
|
||||
storageConfig, err := storageFactory.NewConfig(unversioned.GroupResource{Group: groupName, Resource: "testtype"})
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to get storage: %v", err)
|
||||
return fmt.Errorf("Unable to get storage config: %v", err)
|
||||
}
|
||||
|
||||
restStorageMap := map[string]rest.Storage{
|
||||
"testtypes": testgroupetcd.NewREST(storage, s.StorageDecorator()),
|
||||
"testtypes": testgroupetcd.NewREST(storageConfig, s.StorageDecorator()),
|
||||
}
|
||||
apiGroupInfo := genericapiserver.APIGroupInfo{
|
||||
GroupMeta: *groupMeta,
|
||||
|
@@ -25,6 +25,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/registry/generic/registry"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
"k8s.io/kubernetes/pkg/storage"
|
||||
"k8s.io/kubernetes/pkg/storage/storagebackend"
|
||||
)
|
||||
|
||||
type REST struct {
|
||||
@@ -32,13 +33,13 @@ type REST struct {
|
||||
}
|
||||
|
||||
// NewREST returns a RESTStorage object that will work with testtype.
|
||||
func NewREST(s storage.Interface, storageDecorator generic.StorageDecorator) *REST {
|
||||
func NewREST(config *storagebackend.Config, storageDecorator generic.StorageDecorator) *REST {
|
||||
prefix := "/testtype"
|
||||
newListFunc := func() runtime.Object { return &testgroup.TestTypeList{} }
|
||||
// Usually you should reuse your RESTCreateStrategy.
|
||||
strategy := &NotNamespaceScoped{}
|
||||
storageInterface := storageDecorator(
|
||||
s, 100, &testgroup.TestType{}, prefix, strategy, newListFunc, storage.NoTriggerPublisher)
|
||||
config, 100, &testgroup.TestType{}, prefix, strategy, newListFunc, storage.NoTriggerPublisher)
|
||||
store := ®istry.Store{
|
||||
NewFunc: func() runtime.Object { return &testgroup.TestType{} },
|
||||
// NewListFunc returns an object capable of storing results of an etcd list.
|
||||
|
Reference in New Issue
Block a user