mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 14:11:14 +00:00
Graceful deletion of resources
This commit adds support to core resources to enable deferred deletion of resources. Clients may optionally specify a time period after which resources must be deleted via an object sent with their DELETE. That object may define an optional grace period in seconds, or allow the default "preferred" value for a resource to be used. Once the object is marked as pending deletion, the deletionTimestamp field will be set and an etcd TTL will be in place. Clients should assume resources that have deletionTimestamp set will be deleted at some point in the future. Other changes will come later to enable graceful deletion on a per resource basis.
This commit is contained in:
@@ -312,7 +312,7 @@ func TestDeleteNamespace(t *testing.T) {
|
||||
},
|
||||
}
|
||||
storage := NewREST(helper)
|
||||
_, err := storage.Delete(api.NewDefaultContext(), "foo")
|
||||
_, err := storage.Delete(api.NewDefaultContext(), "foo", nil)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ type Registry interface {
|
||||
// Storage is an interface for a standard REST Storage backend
|
||||
// TODO: move me somewhere common
|
||||
type Storage interface {
|
||||
apiserver.RESTDeleter
|
||||
apiserver.RESTGracefulDeleter
|
||||
apiserver.RESTLister
|
||||
apiserver.RESTGetter
|
||||
apiserver.ResourceWatcher
|
||||
@@ -95,6 +95,6 @@ func (s *storage) UpdateNamespace(ctx api.Context, namespace *api.Namespace) err
|
||||
}
|
||||
|
||||
func (s *storage) DeleteNamespace(ctx api.Context, namespaceID string) error {
|
||||
_, err := s.Delete(ctx, namespaceID)
|
||||
_, err := s.Delete(ctx, namespaceID, nil)
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user