Implement Destroy() method for all registries
Kubernetes-commit: 80060a502c3f86f00800fbeba7684a85f1ce5e17
This commit is contained in:
parent
fbdcc3ee50
commit
8010e8e7e3
|
|
@ -462,6 +462,9 @@ func (storage *SimpleRESTStorage) NewList() runtime.Object {
|
|||
return &genericapitesting.SimpleList{}
|
||||
}
|
||||
|
||||
func (storage *SimpleRESTStorage) Destroy() {
|
||||
}
|
||||
|
||||
func (storage *SimpleRESTStorage) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
|
||||
storage.checkContext(ctx)
|
||||
storage.created = obj.(*genericapitesting.Simple)
|
||||
|
|
@ -547,6 +550,9 @@ func (s *ConnecterRESTStorage) New() runtime.Object {
|
|||
return &genericapitesting.Simple{}
|
||||
}
|
||||
|
||||
func (s *ConnecterRESTStorage) Destroy() {
|
||||
}
|
||||
|
||||
func (s *ConnecterRESTStorage) Connect(ctx context.Context, id string, options runtime.Object, responder rest.Responder) (http.Handler, error) {
|
||||
s.receivedConnectOptions = options
|
||||
s.receivedID = id
|
||||
|
|
@ -668,6 +674,9 @@ func (storage *SimpleTypedStorage) New() runtime.Object {
|
|||
return storage.baseType
|
||||
}
|
||||
|
||||
func (storage *SimpleTypedStorage) Destroy() {
|
||||
}
|
||||
|
||||
func (storage *SimpleTypedStorage) Get(ctx context.Context, id string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
storage.checkContext(ctx)
|
||||
return storage.item.DeepCopyObject(), storage.errors["get"]
|
||||
|
|
@ -810,6 +819,9 @@ func (UnimplementedRESTStorage) New() runtime.Object {
|
|||
return &genericapitesting.Simple{}
|
||||
}
|
||||
|
||||
func (UnimplementedRESTStorage) Destroy() {
|
||||
}
|
||||
|
||||
// TestUnimplementedRESTStorage ensures that if a rest.Storage does not implement a given
|
||||
// method, that it is literally not registered with the server. In the past,
|
||||
// we registered everything, and returned method not supported if it didn't support
|
||||
|
|
@ -4322,6 +4334,9 @@ func (storage *SimpleXGSubresourceRESTStorage) New() runtime.Object {
|
|||
return &genericapitesting.SimpleXGSubresource{}
|
||||
}
|
||||
|
||||
func (storage *SimpleXGSubresourceRESTStorage) Destroy() {
|
||||
}
|
||||
|
||||
func (storage *SimpleXGSubresourceRESTStorage) Get(ctx context.Context, id string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
return storage.item.DeepCopyObject(), nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,11 @@ type Storage interface {
|
|||
// New returns an empty object that can be used with Create and Update after request data has been put into it.
|
||||
// This object must be a pointer type for use with Codec.DecodeInto([]byte, runtime.Object)
|
||||
New() runtime.Object
|
||||
|
||||
// Destroy cleans up its resources on shutdown.
|
||||
// Destroy has to be implemented in thread-safe way and be prepared
|
||||
// for being called more than once.
|
||||
Destroy()
|
||||
}
|
||||
|
||||
// Scoper indicates what scope the resource is at. It must be specified.
|
||||
|
|
|
|||
|
|
@ -110,6 +110,9 @@ func (r removedInStorage) New() runtime.Object {
|
|||
return removedInObj{major: r.major, minor: r.minor}
|
||||
}
|
||||
|
||||
func (r removedInStorage) Destroy() {
|
||||
}
|
||||
|
||||
type neverRemovedObj struct {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,9 +92,7 @@ type APIGroupInfo struct {
|
|||
func (a *APIGroupInfo) destroyStorage() {
|
||||
for _, stores := range a.VersionedResourcesStorageMap {
|
||||
for _, store := range stores {
|
||||
// TODO(wojtek-t): Uncomment once all storage support it.
|
||||
klog.Errorf("Destroying storage: %v", store)
|
||||
// store.Destroy()
|
||||
store.Destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -544,6 +544,9 @@ func (p *testGetterStorage) New() runtime.Object {
|
|||
}
|
||||
}
|
||||
|
||||
func (p *testGetterStorage) Destroy() {
|
||||
}
|
||||
|
||||
func (p *testGetterStorage) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
@ -565,6 +568,9 @@ func (p *testNoVerbsStorage) New() runtime.Object {
|
|||
}
|
||||
}
|
||||
|
||||
func (p *testNoVerbsStorage) Destroy() {
|
||||
}
|
||||
|
||||
func fakeVersion() version.Info {
|
||||
return version.Info{
|
||||
Major: "42",
|
||||
|
|
|
|||
Loading…
Reference in New Issue