UPSTREAM: 46390: Require DeleteStrategy for all registry.Store
All registry.Store objects already set a non-nil DeleteStrategy.
This change ensures that all future objects do so as well.
@@ -143,8 +143,7 @@ type Store struct {
// AfterUpdate implements a further operation to run after a resource is
// updated and before it is decorated, optional.
AfterUpdate ObjectFunc
- // DeleteStrategy implements resource-specific behavior during deletion,
- // optional.
+ // DeleteStrategy implements resource-specific behavior during deletion.
DeleteStrategy rest.RESTDeleteStrategy
// AfterDelete implements a further operation to run after a resource is
// deleted and before it is decorated, optional.
@@ -1140,6 +1139,10 @@ func (e *Store) CompleteWithOptions(options *generic.StoreOptions) error {
return fmt.Errorf("store for %s must have CreateStrategy or UpdateStrategy set", e.QualifiedResource.String())
}
+ if e.DeleteStrategy == nil {
+ return fmt.Errorf("store for %s must have DeleteStrategy set", e.QualifiedResource.String())
+ }
+
if options.RESTOptions == nil {
return fmt.Errorf("options for %s must have RESTOptions set", e.QualifiedResource.String())
}
