Skip to content

Commit

Permalink
Embed generic etcd in namespace rest store
Browse files Browse the repository at this point in the history
  • Loading branch information
derekwaynecarr committed Mar 16, 2015
1 parent 2d13dfa commit 9824d2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 44 deletions.
45 changes: 2 additions & 43 deletions pkg/registry/namespace/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/namespace"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
)

// rest implements a RESTStorage for namespaces against etcd
type REST struct {
store *etcdgeneric.Etcd
*etcdgeneric.Etcd
}

// NewREST returns a RESTStorage object that will work against namespaces
Expand All @@ -57,45 +56,5 @@ func NewREST(h tools.EtcdHelper) *REST {
store.UpdateStrategy = namespace.Strategy
store.ReturnDeletedObject = true

return &REST{store: store}
}

// New returns a new object
func (r *REST) New() runtime.Object {
return r.store.NewFunc()
}

// NewList returns a new list object
func (r *REST) NewList() runtime.Object {
return r.store.NewListFunc()
}

// List obtains a list of namespaces with labels that match selector.
func (r *REST) List(ctx api.Context, label labels.Selector, field fields.Selector) (runtime.Object, error) {
return r.store.List(ctx, label, field)
}

// Watch begins watching for new, changed, or deleted namespaces
func (r *REST) Watch(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) {
return r.store.Watch(ctx, label, field, resourceVersion)
}

// Get gets a specific namespace specified by its name
func (r *REST) Get(ctx api.Context, name string) (runtime.Object, error) {
return r.store.Get(ctx, name)
}

// Create creates a namespace based on a specification.
func (r *REST) Create(ctx api.Context, obj runtime.Object) (runtime.Object, error) {
return r.store.Create(ctx, obj)
}

// Update changes a namespace specification.
func (r *REST) Update(ctx api.Context, obj runtime.Object) (runtime.Object, bool, error) {
return r.store.Update(ctx, obj)
}

// Delete deletes an existing namespace specified by its name
func (r *REST) Delete(ctx api.Context, name string) (runtime.Object, error) {
return r.store.Delete(ctx, name)
return &REST{Etcd: store}
}
2 changes: 1 addition & 1 deletion pkg/registry/namespace/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type namespaceStrategy struct {
// objects via the REST API.
var Strategy = namespaceStrategy{api.Scheme, api.SimpleNameGenerator}

// NamespaceScoped is true for namespaces.
// NamespaceScoped is false for namespaces.
func (namespaceStrategy) NamespaceScoped() bool {
return false
}
Expand Down

0 comments on commit 9824d2b

Please sign in to comment.