Implement Destroy() method for all registries

This commit is contained in:
Wojciech Tyczyński
2022-04-05 12:26:22 +02:00
parent 0527a0dd45
commit 80060a502c
47 changed files with 356 additions and 5 deletions

View File

@@ -98,6 +98,11 @@ func (r *REST) New() runtime.Object {
return r.store.New()
}
// Destroy cleans up resources on shutdown.
func (r *REST) Destroy() {
r.store.Destroy()
}
func (r *REST) NewList() runtime.Object {
return r.store.NewList()
}
@@ -300,6 +305,12 @@ func (r *StatusREST) New() runtime.Object {
return r.store.New()
}
// Destroy cleans up resources on shutdown.
func (r *StatusREST) Destroy() {
// Given that underlying store is shared with REST,
// we don't destroy it here explicitly.
}
// Get retrieves the object from the storage. It is required to support Patch.
func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
return r.store.Get(ctx, name, options)
@@ -325,6 +336,12 @@ func (r *FinalizeREST) New() runtime.Object {
return r.store.New()
}
// Destroy cleans up resources on shutdown.
func (r *FinalizeREST) Destroy() {
// Given that underlying store is shared with REST,
// we don't destroy it here explicitly.
}
// Update alters the status finalizers subset of an object.
func (r *FinalizeREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
// We are explicitly setting forceAllowCreate to false in the call to the underlying storage because