Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/client/fake/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,8 @@ func (c *fakeClient) Delete(ctx context.Context, obj client.Object, opts ...clie
}
delOptions := client.DeleteOptions{}
delOptions.ApplyOptions(opts)
now := metav1.Now()
obj.SetDeletionTimestamp(&now)

for _, dryRunOpt := range delOptions.DryRun {
if dryRunOpt == metav1.DryRunAll {
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/metadata_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ func (mc *metadataClient) Delete(ctx context.Context, obj Object, opts ...Delete

deleteOpts := DeleteOptions{}
deleteOpts.ApplyOptions(opts)
now := metav1.Now()
metadata.SetDeletionTimestamp(&now)

return resInt.Delete(ctx, metadata.Name, *deleteOpts.AsDeleteOptions())
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/client/typed_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package client
import (
"context"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)

Expand Down Expand Up @@ -78,6 +79,8 @@ func (c *typedClient) Delete(ctx context.Context, obj Object, opts ...DeleteOpti

deleteOpts := DeleteOptions{}
deleteOpts.ApplyOptions(opts)
now := metav1.Now()
o.SetDeletionTimestamp(&now)

return o.Delete().
NamespaceIfScoped(o.GetNamespace(), o.isNamespaced()).
Expand Down
3 changes: 3 additions & 0 deletions pkg/client/unstructured_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"strings"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)

Expand Down Expand Up @@ -104,6 +105,8 @@ func (uc *unstructuredClient) Delete(ctx context.Context, obj Object, opts ...De

deleteOpts := DeleteOptions{}
deleteOpts.ApplyOptions(opts)
now := metav1.Now()
o.SetDeletionTimestamp(&now)

return o.Delete().
NamespaceIfScoped(o.GetNamespace(), o.isNamespaced()).
Expand Down
Loading