Skip to content

Commit 2a59005

Browse files
committed
update client.Delete() usage
1 parent 184d4c2 commit 2a59005

File tree

1 file changed

+5
-31
lines changed

1 file changed

+5
-31
lines changed

doc/user/client.md

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -271,39 +271,13 @@ func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, e
271271

272272
```Go
273273
// Delete deletes the given obj from Kubernetes cluster.
274-
func (c Client) Delete(ctx context.Context, obj runtime.Object, opts ...DeleteOptionFunc) error
275-
```
276-
A `client.DeleteOptionFunc` sets fields of `client.DeleteOptions` to configure a `Delete` call:
277-
```Go
278-
// DeleteOptionFunc is a function that mutates a DeleteOptions struct.
279-
type DeleteOptionFunc func(*DeleteOptions)
280-
281-
type DeleteOptions struct {
282-
// GracePeriodSeconds is the duration in seconds before the object should be
283-
// deleted. Value must be non-negative integer. The value zero indicates
284-
// delete immediately. If this value is nil, the default grace period for the
285-
// specified type will be used.
286-
GracePeriodSeconds *int64
287-
288-
// Preconditions must be fulfilled before a deletion is carried out. If not
289-
// possible, a 409 Conflict status will be returned.
290-
Preconditions *metav1.Preconditions
291-
292-
// PropagationPolicy determined whether and how garbage collection will be
293-
// performed. Either this field or OrphanDependents may be set, but not both.
294-
// The default policy is decided by the existing finalizer set in the
295-
// metadata.finalizers and the resource-specific default policy.
296-
// Acceptable values are: 'Orphan' - orphan the dependents; 'Background' -
297-
// allow the garbage collector to delete the dependents in the background;
298-
// 'Foreground' - a cascading policy that deletes all dependents in the
299-
// foreground.
300-
PropagationPolicy *metav1.DeletionPropagation
301-
302-
// Raw represents raw DeleteOptions, as passed to the API server.
303-
Raw *metav1.DeleteOptions
304-
}
274+
func (c Client) Delete(ctx context.Context, obj runtime.Object, opts ...client.DeleteOption) error
305275
```
276+
277+
A `client.DeleteOption` is an interface that sets [`client.DeleteOptions`](https://github.com/kubernetes-sigs/controller-runtime/blob/v0.2.0-rc.0/pkg/client/options.go#L156) fields. A `client.DeleteOption` is created by using one of the provided implementations: [`GracePeriodSeconds`](https://github.com/kubernetes-sigs/controller-runtime/blob/v0.2.0-rc.0/pkg/client/options.go#L216), [`Preconditions`](https://github.com/kubernetes-sigs/controller-runtime/blob/v0.2.0-rc.0/pkg/client/options.go#L227), [`PropagationPolicy`](https://github.com/kubernetes-sigs/controller-runtime/blob/v0.2.0-rc.0/pkg/client/options.go#L238).
278+
306279
Example:
280+
307281
```Go
308282
import (
309283
"context"

0 commit comments

Comments
 (0)