diff --git a/cmd/kube-apiserver/app/server.go b/cmd/kube-apiserver/app/server.go index cda6ca16448..9c737d2380f 100644 --- a/cmd/kube-apiserver/app/server.go +++ b/cmd/kube-apiserver/app/server.go @@ -217,7 +217,7 @@ func (s *APIServer) verifyClusterIPFlags() { } } -func newEtcd(etcdConfigFile string, etcdServerList util.StringList, storageVersion string, pathPrefix string) (etcdStorage storage.StorageInterface, err error) { +func newEtcd(etcdConfigFile string, etcdServerList util.StringList, storageVersion string, pathPrefix string) (etcdStorage storage.Interface, err error) { var client tools.EtcdClient if etcdConfigFile != "" { client, err = etcd.NewClientFromFile(etcdConfigFile) diff --git a/pkg/apiserver/authn.go b/pkg/apiserver/authn.go index bb393f65043..d40aa3eb0e8 100644 --- a/pkg/apiserver/authn.go +++ b/pkg/apiserver/authn.go @@ -32,7 +32,7 @@ import ( ) // NewAuthenticator returns an authenticator.Request or an error -func NewAuthenticator(basicAuthFile, clientCAFile, tokenFile, serviceAccountKeyFile string, serviceAccountLookup bool, storage storage.StorageInterface) (authenticator.Request, error) { +func NewAuthenticator(basicAuthFile, clientCAFile, tokenFile, serviceAccountKeyFile string, serviceAccountLookup bool, storage storage.Interface) (authenticator.Request, error) { var authenticators []authenticator.Request if len(basicAuthFile) > 0 { @@ -104,7 +104,7 @@ func newAuthenticatorFromTokenFile(tokenAuthFile string) (authenticator.Request, } // newServiceAccountAuthenticator returns an authenticator.Request or an error -func newServiceAccountAuthenticator(keyfile string, lookup bool, storage storage.StorageInterface) (authenticator.Request, error) { +func newServiceAccountAuthenticator(keyfile string, lookup bool, storage storage.Interface) (authenticator.Request, error) { publicKey, err := serviceaccount.ReadPublicKey(keyfile) if err != nil { return nil, err diff --git a/pkg/master/master.go b/pkg/master/master.go index ad04378d5ad..070ccf15e61 100644 --- a/pkg/master/master.go +++ b/pkg/master/master.go @@ -88,7 +88,7 @@ const ( // Config is a structure used to configure a Master. type Config struct { - DatabaseStorage storage.StorageInterface + DatabaseStorage storage.Interface EventTTL time.Duration MinionRegexp string KubeletClient client.KubeletClient @@ -224,9 +224,9 @@ type Master struct { clock util.Clock } -// NewEtcdStorage returns a StorageInterface for the provided arguments or an error if the version +// NewEtcdStorage returns a storage.Interface for the provided arguments or an error if the version // is incorrect. -func NewEtcdStorage(client tools.EtcdClient, version string, prefix string) (etcdStorage storage.StorageInterface, err error) { +func NewEtcdStorage(client tools.EtcdClient, version string, prefix string) (etcdStorage storage.Interface, err error) { if version == "" { version = latest.Version } diff --git a/pkg/registry/controller/etcd/etcd.go b/pkg/registry/controller/etcd/etcd.go index 9acdd12e610..75a08e1f02c 100644 --- a/pkg/registry/controller/etcd/etcd.go +++ b/pkg/registry/controller/etcd/etcd.go @@ -37,7 +37,7 @@ type REST struct { var controllerPrefix = "/controllers" // NewREST returns a RESTStorage object that will work against replication controllers. -func NewREST(s storage.StorageInterface) *REST { +func NewREST(s storage.Interface) *REST { store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.ReplicationController{} }, diff --git a/pkg/registry/controller/etcd/etcd_test.go b/pkg/registry/controller/etcd/etcd_test.go index d2606cd1523..37fc2a6e1a1 100644 --- a/pkg/registry/controller/etcd/etcd_test.go +++ b/pkg/registry/controller/etcd/etcd_test.go @@ -41,7 +41,7 @@ const ( FAIL ) -func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.StorageInterface) { +func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient := tools.NewFakeEtcdClient(t) fakeEtcdClient.TestIndex = true etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) diff --git a/pkg/registry/endpoint/etcd/etcd.go b/pkg/registry/endpoint/etcd/etcd.go index 2a0b10cb143..0068487a334 100644 --- a/pkg/registry/endpoint/etcd/etcd.go +++ b/pkg/registry/endpoint/etcd/etcd.go @@ -33,7 +33,7 @@ type REST struct { } // NewStorage returns a RESTStorage object that will work against endpoints. -func NewStorage(s storage.StorageInterface) *REST { +func NewStorage(s storage.Interface) *REST { prefix := "/services/endpoints" return &REST{ &etcdgeneric.Etcd{ diff --git a/pkg/registry/endpoint/etcd/etcd_test.go b/pkg/registry/endpoint/etcd/etcd_test.go index e7d75bd91cd..4daed4444b4 100644 --- a/pkg/registry/endpoint/etcd/etcd_test.go +++ b/pkg/registry/endpoint/etcd/etcd_test.go @@ -33,7 +33,7 @@ import ( "github.com/coreos/go-etcd/etcd" ) -func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.StorageInterface) { +func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient := tools.NewFakeEtcdClient(t) fakeEtcdClient.TestIndex = true etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) diff --git a/pkg/registry/etcd/etcd.go b/pkg/registry/etcd/etcd.go index 6a907f6753c..1723c718d8a 100644 --- a/pkg/registry/etcd/etcd.go +++ b/pkg/registry/etcd/etcd.go @@ -45,17 +45,17 @@ const ( // Registry implements BindingRegistry, ControllerRegistry, EndpointRegistry, // MinionRegistry, PodRegistry and ServiceRegistry, backed by etcd. type Registry struct { - storage.StorageInterface + storage.Interface pods pod.Registry endpoints endpoint.Registry } // NewRegistry creates an etcd registry. -func NewRegistry(storage storage.StorageInterface, pods pod.Registry, endpoints endpoint.Registry) *Registry { +func NewRegistry(storage storage.Interface, pods pod.Registry, endpoints endpoint.Registry) *Registry { registry := &Registry{ - StorageInterface: storage, - pods: pods, - endpoints: endpoints, + Interface: storage, + pods: pods, + endpoints: endpoints, } return registry } diff --git a/pkg/registry/event/registry.go b/pkg/registry/event/registry.go index cf129c6493b..c3025fd2bab 100644 --- a/pkg/registry/event/registry.go +++ b/pkg/registry/event/registry.go @@ -31,7 +31,7 @@ type registry struct { // NewEtcdRegistry returns a registry which will store Events in the given // EtcdStorage. ttl is the time that Events will be retained by the system. -func NewEtcdRegistry(s storage.StorageInterface, ttl uint64) generic.Registry { +func NewEtcdRegistry(s storage.Interface, ttl uint64) generic.Registry { prefix := "/events" return registry{ Etcd: &etcdgeneric.Etcd{ diff --git a/pkg/registry/generic/etcd/etcd.go b/pkg/registry/generic/etcd/etcd.go index c0a0db5d32e..edc61d56dbc 100644 --- a/pkg/registry/generic/etcd/etcd.go +++ b/pkg/registry/generic/etcd/etcd.go @@ -104,7 +104,7 @@ type Etcd struct { ReturnDeletedObject bool // Used for all etcd access functions - Storage storage.StorageInterface + Storage storage.Interface } // NamespaceKeyRootFunc is the default function for constructing etcd paths to resource directories enforcing namespace rules. diff --git a/pkg/registry/limitrange/registry.go b/pkg/registry/limitrange/registry.go index bca1ab6e2b4..b6efa9e6fef 100644 --- a/pkg/registry/limitrange/registry.go +++ b/pkg/registry/limitrange/registry.go @@ -30,7 +30,7 @@ type registry struct { } // NewEtcdRegistry returns a registry which will store LimitRange in the given storage -func NewEtcdRegistry(s storage.StorageInterface) generic.Registry { +func NewEtcdRegistry(s storage.Interface) generic.Registry { prefix := "/limitranges" return registry{ Etcd: &etcdgeneric.Etcd{ diff --git a/pkg/registry/minion/etcd/etcd.go b/pkg/registry/minion/etcd/etcd.go index 1339d4f6f02..48388ed6ed5 100644 --- a/pkg/registry/minion/etcd/etcd.go +++ b/pkg/registry/minion/etcd/etcd.go @@ -49,7 +49,7 @@ func (r *StatusREST) Update(ctx api.Context, obj runtime.Object) (runtime.Object } // NewStorage returns a RESTStorage object that will work against nodes. -func NewStorage(s storage.StorageInterface, connection client.ConnectionInfoGetter) (*REST, *StatusREST) { +func NewStorage(s storage.Interface, connection client.ConnectionInfoGetter) (*REST, *StatusREST) { prefix := "/minions" store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.Node{} }, diff --git a/pkg/registry/minion/etcd/etcd_test.go b/pkg/registry/minion/etcd/etcd_test.go index 2c22b8a62f2..e065dddbda6 100644 --- a/pkg/registry/minion/etcd/etcd_test.go +++ b/pkg/registry/minion/etcd/etcd_test.go @@ -48,7 +48,7 @@ func (fakeConnectionInfoGetter) GetConnectionInfo(host string) (string, uint, ht return "http", 12345, nil, nil } -func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.StorageInterface) { +func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient := tools.NewFakeEtcdClient(t) fakeEtcdClient.TestIndex = true etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) diff --git a/pkg/registry/namespace/etcd/etcd.go b/pkg/registry/namespace/etcd/etcd.go index 2ad947ba584..e5c77f6ca2c 100644 --- a/pkg/registry/namespace/etcd/etcd.go +++ b/pkg/registry/namespace/etcd/etcd.go @@ -49,7 +49,7 @@ type FinalizeREST struct { } // NewStorage returns a RESTStorage object that will work against namespaces -func NewStorage(s storage.StorageInterface) (*REST, *StatusREST, *FinalizeREST) { +func NewStorage(s storage.Interface) (*REST, *StatusREST, *FinalizeREST) { prefix := "/namespaces" store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.Namespace{} }, diff --git a/pkg/registry/namespace/etcd/etcd_test.go b/pkg/registry/namespace/etcd/etcd_test.go index 88ac5a630fb..1c63d11daf9 100644 --- a/pkg/registry/namespace/etcd/etcd_test.go +++ b/pkg/registry/namespace/etcd/etcd_test.go @@ -34,14 +34,14 @@ import ( "github.com/coreos/go-etcd/etcd" ) -func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.StorageInterface) { +func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient := tools.NewFakeEtcdClient(t) fakeEtcdClient.TestIndex = true etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) return fakeEtcdClient, etcdStorage } -func newStorage(t *testing.T) (*REST, *tools.FakeEtcdClient, storage.StorageInterface) { +func newStorage(t *testing.T) (*REST, *tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient, s := newEtcdStorage(t) storage, _, _ := NewStorage(s) return storage, fakeEtcdClient, s diff --git a/pkg/registry/persistentvolume/etcd/etcd.go b/pkg/registry/persistentvolume/etcd/etcd.go index a08077aea1c..acb3362280e 100644 --- a/pkg/registry/persistentvolume/etcd/etcd.go +++ b/pkg/registry/persistentvolume/etcd/etcd.go @@ -35,7 +35,7 @@ type REST struct { } // NewREST returns a RESTStorage object that will work against PersistentVolume objects. -func NewStorage(s storage.StorageInterface) (*REST, *StatusREST) { +func NewStorage(s storage.Interface) (*REST, *StatusREST) { prefix := "/persistentvolumes" store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.PersistentVolume{} }, diff --git a/pkg/registry/persistentvolume/etcd/etcd_test.go b/pkg/registry/persistentvolume/etcd/etcd_test.go index 36f2c223943..eab2fe50324 100644 --- a/pkg/registry/persistentvolume/etcd/etcd_test.go +++ b/pkg/registry/persistentvolume/etcd/etcd_test.go @@ -39,7 +39,7 @@ type testRegistry struct { *registrytest.GenericRegistry } -func newStorage(t *testing.T) (*REST, *StatusREST, *tools.FakeEtcdClient, storage.StorageInterface) { +func newStorage(t *testing.T) (*REST, *StatusREST, *tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient := tools.NewFakeEtcdClient(t) fakeEtcdClient.TestIndex = true etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) diff --git a/pkg/registry/persistentvolumeclaim/etcd/etcd.go b/pkg/registry/persistentvolumeclaim/etcd/etcd.go index 5461a53b2bc..384601976e9 100644 --- a/pkg/registry/persistentvolumeclaim/etcd/etcd.go +++ b/pkg/registry/persistentvolumeclaim/etcd/etcd.go @@ -33,7 +33,7 @@ type REST struct { } // NewREST returns a RESTStorage object that will work against PersistentVolumeClaim objects. -func NewStorage(s storage.StorageInterface) (*REST, *StatusREST) { +func NewStorage(s storage.Interface) (*REST, *StatusREST) { prefix := "/persistentvolumeclaims" store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.PersistentVolumeClaim{} }, diff --git a/pkg/registry/persistentvolumeclaim/etcd/etcd_test.go b/pkg/registry/persistentvolumeclaim/etcd/etcd_test.go index 3eeb9ed4911..a663edceef6 100644 --- a/pkg/registry/persistentvolumeclaim/etcd/etcd_test.go +++ b/pkg/registry/persistentvolumeclaim/etcd/etcd_test.go @@ -39,7 +39,7 @@ type testRegistry struct { *registrytest.GenericRegistry } -func newStorage(t *testing.T) (*REST, *StatusREST, *tools.FakeEtcdClient, storage.StorageInterface) { +func newStorage(t *testing.T) (*REST, *StatusREST, *tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient := tools.NewFakeEtcdClient(t) fakeEtcdClient.TestIndex = true etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) diff --git a/pkg/registry/pod/etcd/etcd.go b/pkg/registry/pod/etcd/etcd.go index dd402a6077d..335f61625e6 100644 --- a/pkg/registry/pod/etcd/etcd.go +++ b/pkg/registry/pod/etcd/etcd.go @@ -57,7 +57,7 @@ type REST struct { } // NewStorage returns a RESTStorage object that will work against pods. -func NewStorage(s storage.StorageInterface, k client.ConnectionInfoGetter) PodStorage { +func NewStorage(s storage.Interface, k client.ConnectionInfoGetter) PodStorage { prefix := "/pods" store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.Pod{} }, diff --git a/pkg/registry/pod/etcd/etcd_test.go b/pkg/registry/pod/etcd/etcd_test.go index 2cdc935dcdd..3e22533a017 100644 --- a/pkg/registry/pod/etcd/etcd_test.go +++ b/pkg/registry/pod/etcd/etcd_test.go @@ -41,14 +41,14 @@ import ( "github.com/coreos/go-etcd/etcd" ) -func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.StorageInterface) { +func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient := tools.NewFakeEtcdClient(t) fakeEtcdClient.TestIndex = true etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) return fakeEtcdClient, etcdStorage } -func newStorage(t *testing.T) (*REST, *BindingREST, *StatusREST, *tools.FakeEtcdClient, storage.StorageInterface) { +func newStorage(t *testing.T) (*REST, *BindingREST, *StatusREST, *tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient, etcdStorage := newEtcdStorage(t) storage := NewStorage(etcdStorage, nil) return storage.Pod, storage.Binding, storage.Status, fakeEtcdClient, etcdStorage diff --git a/pkg/registry/podtemplate/etcd/etcd.go b/pkg/registry/podtemplate/etcd/etcd.go index 466940b7d7b..96d49695b9a 100644 --- a/pkg/registry/podtemplate/etcd/etcd.go +++ b/pkg/registry/podtemplate/etcd/etcd.go @@ -33,7 +33,7 @@ type REST struct { } // NewREST returns a RESTStorage object that will work against pod templates. -func NewREST(s storage.StorageInterface) *REST { +func NewREST(s storage.Interface) *REST { prefix := "/podtemplates" store := etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.PodTemplate{} }, diff --git a/pkg/registry/podtemplate/etcd/etcd_test.go b/pkg/registry/podtemplate/etcd/etcd_test.go index 8db20014533..7070fcce638 100644 --- a/pkg/registry/podtemplate/etcd/etcd_test.go +++ b/pkg/registry/podtemplate/etcd/etcd_test.go @@ -27,7 +27,7 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" ) -func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.StorageInterface) { +func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient := tools.NewFakeEtcdClient(t) fakeEtcdClient.TestIndex = true etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, testapi.Codec(), etcdtest.PathPrefix()) diff --git a/pkg/registry/resourcequota/etcd/etcd.go b/pkg/registry/resourcequota/etcd/etcd.go index e542593d928..11225fcf0a1 100644 --- a/pkg/registry/resourcequota/etcd/etcd.go +++ b/pkg/registry/resourcequota/etcd/etcd.go @@ -33,7 +33,7 @@ type REST struct { } // NewStorage returns a RESTStorage object that will work against ResourceQuota objects. -func NewStorage(s storage.StorageInterface) (*REST, *StatusREST) { +func NewStorage(s storage.Interface) (*REST, *StatusREST) { prefix := "/resourcequotas" store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.ResourceQuota{} }, diff --git a/pkg/registry/resourcequota/etcd/etcd_test.go b/pkg/registry/resourcequota/etcd/etcd_test.go index 71c9c909452..d98ad3e3bd0 100644 --- a/pkg/registry/resourcequota/etcd/etcd_test.go +++ b/pkg/registry/resourcequota/etcd/etcd_test.go @@ -39,14 +39,14 @@ import ( "github.com/coreos/go-etcd/etcd" ) -func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.StorageInterface) { +func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient := tools.NewFakeEtcdClient(t) fakeEtcdClient.TestIndex = true etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix()) return fakeEtcdClient, etcdStorage } -func newStorage(t *testing.T) (*REST, *StatusREST, *tools.FakeEtcdClient, storage.StorageInterface) { +func newStorage(t *testing.T) (*REST, *StatusREST, *tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient, h := newEtcdStorage(t) storage, statusStorage := NewStorage(h) return storage, statusStorage, fakeEtcdClient, h diff --git a/pkg/registry/secret/etcd/etcd.go b/pkg/registry/secret/etcd/etcd.go index 4a956041315..6d678c351e1 100644 --- a/pkg/registry/secret/etcd/etcd.go +++ b/pkg/registry/secret/etcd/etcd.go @@ -33,7 +33,7 @@ type REST struct { } // NewStorage returns a registry which will store Secret in the given etcdStorage -func NewStorage(s storage.StorageInterface) *REST { +func NewStorage(s storage.Interface) *REST { prefix := "/secrets" store := &etcdgeneric.Etcd{ diff --git a/pkg/registry/secret/etcd/etcd_test.go b/pkg/registry/secret/etcd/etcd_test.go index b9a5bf6a1a4..4c4e2ae258d 100644 --- a/pkg/registry/secret/etcd/etcd_test.go +++ b/pkg/registry/secret/etcd/etcd_test.go @@ -27,7 +27,7 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" ) -func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.StorageInterface) { +func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient := tools.NewFakeEtcdClient(t) fakeEtcdClient.TestIndex = true etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, testapi.Codec(), etcdtest.PathPrefix()) diff --git a/pkg/registry/service/allocator/etcd/etcd.go b/pkg/registry/service/allocator/etcd/etcd.go index 2e17119beb6..8548e3df24d 100644 --- a/pkg/registry/service/allocator/etcd/etcd.go +++ b/pkg/registry/service/allocator/etcd/etcd.go @@ -43,7 +43,7 @@ type Etcd struct { lock sync.Mutex alloc allocator.Snapshottable - storage storage.StorageInterface + storage storage.Interface last string baseKey string @@ -56,7 +56,7 @@ var _ service.RangeRegistry = &Etcd{} // NewEtcd returns an allocator that is backed by Etcd and can manage // persisting the snapshot state of allocation after each allocation is made. -func NewEtcd(alloc allocator.Snapshottable, baseKey string, kind string, storage storage.StorageInterface) *Etcd { +func NewEtcd(alloc allocator.Snapshottable, baseKey string, kind string, storage storage.Interface) *Etcd { return &Etcd{ alloc: alloc, storage: storage, diff --git a/pkg/registry/service/allocator/etcd/etcd_test.go b/pkg/registry/service/allocator/etcd/etcd_test.go index 90577494a80..449a9508fe1 100644 --- a/pkg/registry/service/allocator/etcd/etcd_test.go +++ b/pkg/registry/service/allocator/etcd/etcd_test.go @@ -31,7 +31,7 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" ) -func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.StorageInterface) { +func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient := tools.NewFakeEtcdClient(t) fakeEtcdClient.TestIndex = true etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, testapi.Codec(), etcdtest.PathPrefix()) diff --git a/pkg/registry/service/ipallocator/etcd/etcd_test.go b/pkg/registry/service/ipallocator/etcd/etcd_test.go index 047a8dbeb10..284b4cc9809 100644 --- a/pkg/registry/service/ipallocator/etcd/etcd_test.go +++ b/pkg/registry/service/ipallocator/etcd/etcd_test.go @@ -34,7 +34,7 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" ) -func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.StorageInterface) { +func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient := tools.NewFakeEtcdClient(t) fakeEtcdClient.TestIndex = true etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, testapi.Codec(), etcdtest.PathPrefix()) diff --git a/pkg/registry/serviceaccount/etcd/etcd.go b/pkg/registry/serviceaccount/etcd/etcd.go index 23a5703ae81..98e3bed8567 100644 --- a/pkg/registry/serviceaccount/etcd/etcd.go +++ b/pkg/registry/serviceaccount/etcd/etcd.go @@ -35,7 +35,7 @@ type REST struct { const Prefix = "/serviceaccounts" // NewStorage returns a RESTStorage object that will work against service accounts objects. -func NewStorage(s storage.StorageInterface) *REST { +func NewStorage(s storage.Interface) *REST { store := &etcdgeneric.Etcd{ NewFunc: func() runtime.Object { return &api.ServiceAccount{} }, NewListFunc: func() runtime.Object { return &api.ServiceAccountList{} }, diff --git a/pkg/registry/serviceaccount/etcd/etcd_test.go b/pkg/registry/serviceaccount/etcd/etcd_test.go index 1cafbed79f2..6719ad3b140 100644 --- a/pkg/registry/serviceaccount/etcd/etcd_test.go +++ b/pkg/registry/serviceaccount/etcd/etcd_test.go @@ -27,7 +27,7 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/tools/etcdtest" ) -func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.StorageInterface) { +func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, storage.Interface) { fakeEtcdClient := tools.NewFakeEtcdClient(t) fakeEtcdClient.TestIndex = true etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, testapi.Codec(), etcdtest.PathPrefix()) diff --git a/pkg/serviceaccount/tokengetter.go b/pkg/serviceaccount/tokengetter.go index edd2bd3bb3f..458f9ab6c43 100644 --- a/pkg/serviceaccount/tokengetter.go +++ b/pkg/serviceaccount/tokengetter.go @@ -73,7 +73,7 @@ func (r *registryGetter) GetSecret(namespace, name string) (*api.Secret, error) // NewGetterFromStorageInterface returns a ServiceAccountTokenGetter that // uses the specified storage to retrieve service accounts and secrets. -func NewGetterFromStorageInterface(storage storage.StorageInterface) ServiceAccountTokenGetter { +func NewGetterFromStorageInterface(storage storage.Interface) ServiceAccountTokenGetter { return NewGetterFromRegistries( serviceaccount.NewRegistry(serviceaccountetcd.NewStorage(storage)), secret.NewRegistry(secretetcd.NewStorage(storage)), diff --git a/pkg/storage/interfaces.go b/pkg/storage/interfaces.go index 2e71d8bf8bd..36829f99b7c 100644 --- a/pkg/storage/interfaces.go +++ b/pkg/storage/interfaces.go @@ -23,9 +23,9 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/watch" ) -// StorageVersioner abstracts setting and retrieving metadata fields from database response +// Versioner abstracts setting and retrieving metadata fields from database response // onto the object ot list. -type StorageVersioner interface { +type Versioner interface { // UpdateObject sets storage metadata into an API object. Returns an error if the object // cannot be updated correctly. May return nil if the requested object does not need metadata // from database. @@ -63,21 +63,21 @@ func Everything(runtime.Object) bool { return true } -// Pass an StorageUpdateFunc to StorageInterface.GuaranteedUpdate to make an update +// Pass an UpdateFunc to Interface.GuaranteedUpdate to make an update // that is guaranteed to succeed. // See the comment for GuaranteedUpdate for more details. -type StorageUpdateFunc func(input runtime.Object, res ResponseMeta) (output runtime.Object, ttl *uint64, err error) +type UpdateFunc func(input runtime.Object, res ResponseMeta) (output runtime.Object, ttl *uint64, err error) -// StorageInterface offers a common interface for object marshaling/unmarshling operations and +// Interface offers a common interface for object marshaling/unmarshling operations and // hids all the storage-related operations behind it. -type StorageInterface interface { +type Interface interface { // Returns list of servers addresses of the underyling database. // TODO: This method is used only in a single place. Consider refactoring and getting rid // of this method from the interface. Backends() []string - // Returns StorageVersioner associated with this interface. - Versioner() StorageVersioner + // Returns Versioner associated with this interface. + Versioner() Versioner // Create adds a new object at a key unless it already exists. 'ttl' is time-to-live // in seconds (0 means forever). If no error is returned and out is not nil, out will be @@ -129,7 +129,7 @@ type StorageInterface interface { // // Exmaple: // - // s := /* implementation of StorageInterface */ + // s := /* implementation of Interface */ // err := s.GuaranteedUpdate( // "myKey", &MyType{}, true, // func(input runtime.Object, res ResponseMeta) (runtime.Object, *uint64, error) { @@ -145,5 +145,5 @@ type StorageInterface interface { // return cur, nil, nil // } // }) - GuaranteedUpdate(key string, ptrToType runtime.Object, ignoreNotFound bool, tryUpdate StorageUpdateFunc) error + GuaranteedUpdate(key string, ptrToType runtime.Object, ignoreNotFound bool, tryUpdate UpdateFunc) error } diff --git a/pkg/tools/etcd_helper.go b/pkg/tools/etcd_helper.go index f8322e7069e..e66da7d842e 100644 --- a/pkg/tools/etcd_helper.go +++ b/pkg/tools/etcd_helper.go @@ -36,7 +36,7 @@ import ( "github.com/golang/glog" ) -func NewEtcdStorage(client EtcdClient, codec runtime.Codec, prefix string) storage.StorageInterface { +func NewEtcdStorage(client EtcdClient, codec runtime.Codec, prefix string) storage.Interface { return &etcdHelper{ client: client, codec: codec, @@ -47,13 +47,13 @@ func NewEtcdStorage(client EtcdClient, codec runtime.Codec, prefix string) stora } } -// etcdHelper is the reference implementation of StorageInterface. +// etcdHelper is the reference implementation of storage.Interface. type etcdHelper struct { client EtcdClient codec runtime.Codec copier runtime.ObjectCopier // optional, has to be set to perform any atomic operations - versioner storage.StorageVersioner + versioner storage.Versioner // prefix for all etcd keys pathPrefix string @@ -71,17 +71,17 @@ func init() { metrics.Register() } -// Implements StorageInterface. +// Implements storage.Interface. func (h *etcdHelper) Backends() []string { return h.client.GetCluster() } -// Implements StorageInterface. -func (h *etcdHelper) Versioner() storage.StorageVersioner { +// Implements storage.Interface. +func (h *etcdHelper) Versioner() storage.Versioner { return h.versioner } -// Implements StorageInterface. +// Implements storage.Interface. func (h *etcdHelper) Create(key string, obj, out runtime.Object, ttl uint64) error { key = h.prefixEtcdKey(key) data, err := h.codec.Encode(obj) @@ -109,7 +109,7 @@ func (h *etcdHelper) Create(key string, obj, out runtime.Object, ttl uint64) err return err } -// Implements StorageInterface. +// Implements storage.Interface. func (h *etcdHelper) Set(key string, obj, out runtime.Object, ttl uint64) error { var response *etcd.Response data, err := h.codec.Encode(obj) @@ -150,7 +150,7 @@ func (h *etcdHelper) Set(key string, obj, out runtime.Object, ttl uint64) error return err } -// Implements StorageInterface. +// Implements storage.Interface. func (h *etcdHelper) Delete(key string, out runtime.Object) error { key = h.prefixEtcdKey(key) if _, err := conversion.EnforcePtr(out); err != nil { @@ -169,7 +169,7 @@ func (h *etcdHelper) Delete(key string, out runtime.Object) error { return err } -// Implements StorageInterface. +// Implements storage.Interface. func (h *etcdHelper) RecursiveDelete(key string, recursive bool) error { key = h.prefixEtcdKey(key) startTime := time.Now() @@ -178,7 +178,7 @@ func (h *etcdHelper) RecursiveDelete(key string, recursive bool) error { return err } -// Implements StorageInterface. +// Implements storage.Interface. func (h *etcdHelper) Watch(key string, resourceVersion uint64, filter storage.FilterFunc) (watch.Interface, error) { key = h.prefixEtcdKey(key) w := newEtcdWatcher(false, nil, filter, h.codec, h.versioner, nil, h) @@ -186,7 +186,7 @@ func (h *etcdHelper) Watch(key string, resourceVersion uint64, filter storage.Fi return w, nil } -// Implements StorageInterface. +// Implements storage.Interface. func (h *etcdHelper) WatchList(key string, resourceVersion uint64, filter storage.FilterFunc) (watch.Interface, error) { key = h.prefixEtcdKey(key) w := newEtcdWatcher(true, exceptKey(key), filter, h.codec, h.versioner, nil, h) @@ -194,7 +194,7 @@ func (h *etcdHelper) WatchList(key string, resourceVersion uint64, filter storag return w, nil } -// Implements StorageInterface. +// Implements storage.Interface. func (h *etcdHelper) Get(key string, objPtr runtime.Object, ignoreNotFound bool) error { key = h.prefixEtcdKey(key) _, _, _, err := h.bodyAndExtractObj(key, objPtr, ignoreNotFound) @@ -245,7 +245,7 @@ func (h *etcdHelper) extractObj(response *etcd.Response, inErr error, objPtr run return body, node, err } -// Implements StorageInterface. +// Implements storage.Interface. func (h *etcdHelper) GetToList(key string, listObj runtime.Object) error { trace := util.NewTrace("GetToList " + getTypeName(listObj)) listPtr, err := runtime.GetItemsPtr(listObj) @@ -319,7 +319,7 @@ func (h *etcdHelper) decodeNodeList(nodes []*etcd.Node, slicePtr interface{}) er return nil } -// Implements StorageInterface. +// Implements storage.Interface. func (h *etcdHelper) List(key string, listObj runtime.Object) error { trace := util.NewTrace("List " + getTypeName(listObj)) defer trace.LogIfLong(time.Second) @@ -367,16 +367,16 @@ func (h *etcdHelper) listEtcdNode(key string) ([]*etcd.Node, uint64, error) { type SimpleUpdateFunc func(runtime.Object) (runtime.Object, error) -// SimpleUpdateFunc converts SimpleUpdateFunc into StorageUpdateFunc -func SimpleUpdate(fn SimpleUpdateFunc) storage.StorageUpdateFunc { +// SimpleUpdateFunc converts SimpleUpdateFunc into UpdateFunc +func SimpleUpdate(fn SimpleUpdateFunc) storage.UpdateFunc { return func(input runtime.Object, _ storage.ResponseMeta) (runtime.Object, *uint64, error) { out, err := fn(input) return out, nil, err } } -// Implements StorageInterface. -func (h *etcdHelper) GuaranteedUpdate(key string, ptrToType runtime.Object, ignoreNotFound bool, tryUpdate storage.StorageUpdateFunc) error { +// Implements storage.Interface. +func (h *etcdHelper) GuaranteedUpdate(key string, ptrToType runtime.Object, ignoreNotFound bool, tryUpdate storage.UpdateFunc) error { v, err := conversion.EnforcePtr(ptrToType) if err != nil { // Panic is appropriate, because this is a programming error. diff --git a/pkg/tools/etcd_object.go b/pkg/tools/etcd_object.go index 362025b36a5..4877a69b5aa 100644 --- a/pkg/tools/etcd_object.go +++ b/pkg/tools/etcd_object.go @@ -30,7 +30,7 @@ import ( // for objects that have an embedded ObjectMeta or ListMeta field. type APIObjectVersioner struct{} -// UpdateObject implements StorageVersioner +// UpdateObject implements Versioner func (a APIObjectVersioner) UpdateObject(obj runtime.Object, expiration *time.Time, resourceVersion uint64) error { objectMeta, err := api.ObjectMetaFor(obj) if err != nil { @@ -47,7 +47,7 @@ func (a APIObjectVersioner) UpdateObject(obj runtime.Object, expiration *time.Ti return nil } -// UpdateList implements StorageVersioner +// UpdateList implements Versioner func (a APIObjectVersioner) UpdateList(obj runtime.Object, resourceVersion uint64) error { listMeta, err := api.ListMetaFor(obj) if err != nil || listMeta == nil { @@ -61,7 +61,7 @@ func (a APIObjectVersioner) UpdateList(obj runtime.Object, resourceVersion uint6 return nil } -// ObjectResourceVersion implements StorageVersioner +// ObjectResourceVersion implements Versioner func (a APIObjectVersioner) ObjectResourceVersion(obj runtime.Object) (uint64, error) { meta, err := api.ObjectMetaFor(obj) if err != nil { @@ -74,5 +74,5 @@ func (a APIObjectVersioner) ObjectResourceVersion(obj runtime.Object) (uint64, e return strconv.ParseUint(version, 10, 64) } -// APIObjectVersioner implements StorageVersioner -var _ storage.StorageVersioner = APIObjectVersioner{} +// APIObjectVersioner implements Versioner +var _ storage.Versioner = APIObjectVersioner{} diff --git a/pkg/tools/etcd_watcher.go b/pkg/tools/etcd_watcher.go index 7455a72cfeb..fcc62357a25 100644 --- a/pkg/tools/etcd_watcher.go +++ b/pkg/tools/etcd_watcher.go @@ -74,7 +74,7 @@ func exceptKey(except string) includeFunc { // etcdWatcher converts a native etcd watch to a watch.Interface. type etcdWatcher struct { encoding runtime.Codec - versioner storage.StorageVersioner + versioner storage.Versioner transform TransformFunc list bool // If we're doing a recursive watch, should be true. @@ -102,7 +102,7 @@ const watchWaitDuration = 100 * time.Millisecond // newEtcdWatcher returns a new etcdWatcher; if list is true, watch sub-nodes. If you provide a transform // and a versioner, the versioner must be able to handle the objects that transform creates. -func newEtcdWatcher(list bool, include includeFunc, filter storage.FilterFunc, encoding runtime.Codec, versioner storage.StorageVersioner, transform TransformFunc, cache etcdCache) *etcdWatcher { +func newEtcdWatcher(list bool, include includeFunc, filter storage.FilterFunc, encoding runtime.Codec, versioner storage.Versioner, transform TransformFunc, cache etcdCache) *etcdWatcher { w := &etcdWatcher{ encoding: encoding, versioner: versioner, diff --git a/test/integration/framework/etcd_utils.go b/test/integration/framework/etcd_utils.go index 9bfac03d726..2104a7bf3cd 100644 --- a/test/integration/framework/etcd_utils.go +++ b/test/integration/framework/etcd_utils.go @@ -41,7 +41,7 @@ func NewEtcdClient() *etcd.Client { return etcd.NewClient([]string{}) } -func NewEtcdStorage() (storage.StorageInterface, error) { +func NewEtcdStorage() (storage.Interface, error) { return master.NewEtcdStorage(NewEtcdClient(), testapi.Version(), etcdtest.PathPrefix()) } diff --git a/test/integration/framework/master_utils.go b/test/integration/framework/master_utils.go index 8f9220f13b0..3d6a2a590da 100644 --- a/test/integration/framework/master_utils.go +++ b/test/integration/framework/master_utils.go @@ -72,7 +72,7 @@ type MasterComponents struct { // Used to stop master components individually, and via MasterComponents.Stop once sync.Once // Kubernetes etcd storage, has embedded etcd client - EtcdStorage storage.StorageInterface + EtcdStorage storage.Interface } // Config is a struct of configuration directives for NewMasterComponents. @@ -119,13 +119,13 @@ func NewMasterComponents(c *Config) *MasterComponents { } // startMasterOrDie starts a kubernetes master and an httpserver to handle api requests -func startMasterOrDie(masterConfig *master.Config) (*master.Master, *httptest.Server, storage.StorageInterface) { +func startMasterOrDie(masterConfig *master.Config) (*master.Master, *httptest.Server, storage.Interface) { var m *master.Master s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { m.Handler.ServeHTTP(w, req) })) - var etcdStorage storage.StorageInterface + var etcdStorage storage.Interface var err error if masterConfig == nil { etcdStorage, err = master.NewEtcdStorage(NewEtcdClient(), "", etcdtest.PathPrefix())